Skip to content

Commit

Permalink
runevox
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Nov 10, 2024
1 parent 30d141e commit 08aa445
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions runevox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import binascii
import hashlib

text = '''The quick brown fox jumps over the lazy dog
Τhe quick brown fox jumps over the lazy dog
Тhe quick brown fox jumps over the lazy dog
'''

# tips for obfuscation
assert 'i' != 'і' and 'T' != 'Τ'

# Supported: md5 sha1 sha224 sha256 sha384 sha512 blake2b blake2s sha3_224 sha3_256 sha3_384 sha3_512
hash_function = hashlib.sha256
digest_size = len(hash_function(b'').digest())
result_digest = b'\0' * digest_size
lines = text.splitlines(keepends=False)
charset = set()
for line in lines:
charset.update(set(line))
data = line.encode('utf8')
line_hash = hash_function(data)
result_digest = bytes(a ^ b for a, b in zip(result_digest, line_hash.digest()))
print(line_hash.hexdigest(), data)
result_hash_line = binascii.hexlify(result_digest).decode('ascii')
print('--' * digest_size)
print(result_hash_line, 'lines:', len(lines), 'chars:', len(charset))

0 comments on commit 08aa445

Please sign in to comment.