# generage the base of <{0,1},F^256,xor,*>defgen_gf2_256_base(): v =VectorSpace(GF(2),256) tmphash =compute_file_hash("0.py","") tmphash_bin =hash2bin(tmphash) base =[tmphash_bin] filelist =['0.py']print base s = v.subspace(base) dim = s.dimension() cnt =1while dim !=256: tmpfile =str(cnt)+".py" tmphash =compute_file_hash(tmpfile,"") tmphash_bin =hash2bin(tmphash) old_dim = dim s = v.subspace(base +[tmphash_bin]) dim = s.dimension()if dim > old_dim: base +=[tmphash_bin] filelist.append(tmpfile)print("dimension "+str(s.dimension())) cnt +=1print(cnt) m =matrix(GF(2),256,256, base) m = m.transpose()return m, filelist
Python 2.7.16 (default, Sep 2 2019, 11:59:44)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> "\u000e\t\u001d\ufffd\u0012\ufffd.\ufffd\ufffd\ufffd?-\ufffdKC\ufffd\u0005\ufffd@\ufffd"
'\\u000e\t\\u001d\\ufffd\\u0012\\ufffd.\\ufffd\\ufffd\\ufffd?-\\ufffdKC\\ufffd\\u0005\\ufffd@\\ufffd'
>>> from hashlib import *
>>> sha1('172.17.0.1|ls -l').digest()
'\x0e\t\x1d\xbd\x12\x90.\xca\xf0\xd9?-\x98KC\xeb\x05\xa1@\xd1'