Created
October 3, 2018 17:25
-
-
Save Nircek/f5619f52c85a17453ca83b7884f2be73 to your computer and use it in GitHub Desktop.
SUBcipher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| a=open('in.txt', 'rb').read() | |
| d = 0 | |
| e = b'' | |
| for i in a: | |
| if d > i: | |
| d -= 256 | |
| e += bytes([i-d]) | |
| d = i | |
| open('out.bin', 'wb').write(e) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| a = open('out.bin', 'rb').read() | |
| c = bytes([a[0]]) | |
| for i in range(1,len(a)): | |
| print(a[i], c[i-1], sep='\t') | |
| c += bytes([(c[i-1]+a[i])%256]) | |
| b = open('out.txt', 'wb').write(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment