mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
The new version of the comment has been generated by the following python3
script, when the first constant is copy-pasted from RFC 5794 2.4.3.
#!/usr/bin/python3
RFC_A = """
y0 = x3 ^ x4 ^ x6 ^ x8 ^ x9 ^ x13 ^ x14,
y1 = x2 ^ x5 ^ x7 ^ x8 ^ x9 ^ x12 ^ x15,
y2 = x1 ^ x4 ^ x6 ^ x10 ^ x11 ^ x12 ^ x15,
y3 = x0 ^ x5 ^ x7 ^ x10 ^ x11 ^ x13 ^ x14,
y4 = x0 ^ x2 ^ x5 ^ x8 ^ x11 ^ x14 ^ x15,
y5 = x1 ^ x3 ^ x4 ^ x9 ^ x10 ^ x14 ^ x15,
y6 = x0 ^ x2 ^ x7 ^ x9 ^ x10 ^ x12 ^ x13,
y7 = x1 ^ x3 ^ x6 ^ x8 ^ x11 ^ x12 ^ x13,
y8 = x0 ^ x1 ^ x4 ^ x7 ^ x10 ^ x13 ^ x15,
y9 = x0 ^ x1 ^ x5 ^ x6 ^ x11 ^ x12 ^ x14,
y10 = x2 ^ x3 ^ x5 ^ x6 ^ x8 ^ x13 ^ x15,
y11 = x2 ^ x3 ^ x4 ^ x7 ^ x9 ^ x12 ^ x14,
y12 = x1 ^ x2 ^ x6 ^ x7 ^ x9 ^ x11 ^ x12,
y13 = x0 ^ x3 ^ x6 ^ x7 ^ x8 ^ x10 ^ x13,
y14 = x0 ^ x3 ^ x4 ^ x5 ^ x9 ^ x11 ^ x14,
y15 = x1 ^ x2 ^ x4 ^ x5 ^ x8 ^ x10 ^ x15.
"""
matrix = []
for l in RFC_A.split('\n')[1:-1]:
rhs = l.split('=')[1][:-1]
row = tuple(hex(int(t[2:]))[2:] for t in rhs.split('^'))
matrix.append(row)
out = {}
out['a'] = tuple(''.join(w) for w in zip(*(matrix[0:4])))
out['b'] = tuple(''.join(w) for w in zip(*(matrix[4:8])))
out['c'] = tuple(''.join(w) for w in zip(*(matrix[8:12])))
out['d'] = tuple(''.join(w) for w in zip(*(matrix[12:])))
out2 = {}
for o, r in out.items():
row = list(r)
for i in range(len(r) - 1):
w1 = row[i]
if len(set(w1)) == 2:
w2 = row[i+1]
nw1 = nw2 = ''
for j in range(len(w1)):
if w1[j] in nw1:
nw1 += w2[j]
nw2 += w1[j]
else:
nw1 += w1[j]
nw2 += w2[j]
row[i] = nw1
row[i+1] = nw2
out2[o] = row
for o in 'abcd':
print(o, '=', ' + '.join(out[o]))
print(' ', '=', ' + '.join(out2[o]))
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| aes.c | ||
| aesni.c | ||
| arc4.c | ||
| aria.c | ||
| asn1parse.c | ||
| asn1write.c | ||
| base64.c | ||
| bignum.c | ||
| blowfish.c | ||
| camellia.c | ||
| ccm.c | ||
| certs.c | ||
| cipher.c | ||
| cipher_wrap.c | ||
| cmac.c | ||
| CMakeLists.txt | ||
| ctr_drbg.c | ||
| debug.c | ||
| des.c | ||
| dhm.c | ||
| ecdh.c | ||
| ecdsa.c | ||
| ecjpake.c | ||
| ecp.c | ||
| ecp_curves.c | ||
| entropy.c | ||
| entropy_poll.c | ||
| error.c | ||
| gcm.c | ||
| havege.c | ||
| hmac_drbg.c | ||
| Makefile | ||
| md.c | ||
| md2.c | ||
| md4.c | ||
| md5.c | ||
| md_wrap.c | ||
| memory_buffer_alloc.c | ||
| net_sockets.c | ||
| oid.c | ||
| padlock.c | ||
| pem.c | ||
| pk.c | ||
| pk_wrap.c | ||
| pkcs5.c | ||
| pkcs11.c | ||
| pkcs12.c | ||
| pkparse.c | ||
| pkwrite.c | ||
| platform.c | ||
| ripemd160.c | ||
| rsa.c | ||
| rsa_internal.c | ||
| sha1.c | ||
| sha256.c | ||
| sha512.c | ||
| ssl_cache.c | ||
| ssl_ciphersuites.c | ||
| ssl_cli.c | ||
| ssl_cookie.c | ||
| ssl_srv.c | ||
| ssl_ticket.c | ||
| ssl_tls.c | ||
| threading.c | ||
| timing.c | ||
| version.c | ||
| version_features.c | ||
| x509.c | ||
| x509_create.c | ||
| x509_crl.c | ||
| x509_crt.c | ||
| x509_csr.c | ||
| x509write_crt.c | ||
| x509write_csr.c | ||
| xtea.c | ||