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
| def decrypt_and_compare(data, key, iv, expected): | |
| unpad = lambda s: s[0:-ord(s[-1])] | |
| aes = Crypto.Cipher.AES.new(key, Crypto.Cipher.AES.MODE_CBC, iv) | |
| # Decrypt each block of data, except for the last one | |
| for i in xrange(0, len(data) - 16, 16): | |
| if aes.decrypt(data[i:i+16]) != expected[i:i+16]: | |
| return False | |
| # Decrypt the last block of data, unpad, and compare |
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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <assert.h> | |
| #include <CommonCrypto/CommonCryptor.h> | |
| #include <CommonCrypto/CommonHMAC.h> | |
| #include <CommonCrypto/CommonKeyDerivation.h> | |
| #include <dispatch/dispatch.h> |
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
| # for http://www.reddit.com/r/codes/comments/3874s7/crack_this_old_code_for_shiny_gold/ | |
| # this is from source to InfoLock 5.5, http://sourceforge.net/projects/infolock | |
| encoder_ring = { | |
| 'a': 8, 'b': 2, 'c': 3, 'd': 4, 'e': 7, 'f': 19, 'g': 5, 'h': 1, 'i': 9, | |
| 'j': 10, 'k': 29, 'l': 12, 'm': 24, 'n': 14, 'o': 15, 'p': 16, 'q': 25, | |
| 'r': 18, 's': 6, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 13, 'y': 17, | |
| 'z': 26, '!': 11, '?': 30, 'A': 31, 'B': 32, 'C': 33, 'D': 34, 'E': 35, | |
| 'F': 36, 'G': 37, 'H': 38, 'I': 39, 'J': 40, 'K': 41, 'L': 42, 'M': 43, | |
| 'N': 44, 'O': 45, 'P': 46, 'Q': 47, 'R': 48, 'S': 49, 'T': 50, 'U': 51, | |
| 'V': 52, 'W': 53, 'X': 54, 'Y': 55, 'Z': 56, ',': 57, '\'': 58, ':': 59, |
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
| diff --git a/Makefile b/Makefile | |
| index ceb9d77..c9bd8fd 100644 | |
| --- a/Makefile | |
| +++ b/Makefile | |
| @@ -60,7 +60,7 @@ SOMINOR=1 | |
| SORELEASE?=.0# Declare empty to leave out from library file name. | |
| MINISAT_CXXFLAGS = -I. -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wall -Wno-parentheses -Wextra | |
| -MINISAT_LDFLAGS = -Wall -lz | |
| +MINISAT_LDFLAGS = -Wall |
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
| diff --git a/CMakeLists.txt b/CMakeLists.txt | |
| index 27fd96f..1cc8f01 100644 | |
| --- a/CMakeLists.txt | |
| +++ b/CMakeLists.txt | |
| @@ -320,14 +320,6 @@ endif() | |
| # ----------------------------------------------------------------------------- | |
| # Find Minisat | |
| # ----------------------------------------------------------------------------- | |
| -find_package(minisat) | |
| -set(MINISAT_INCLUDE_DIRS "" CACHE PATH "MiniSat include directory") |
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
| on UnformatPhoneNumber(theNumber) | |
| set digits to {} | |
| if theNumber starts with "+" then | |
| set the end of digits to "+" | |
| end if | |
| repeat with i from 1 to count of theNumber | |
| set theDigit to item i of theNumber | |
| if theDigit is in "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" then | |
| set the end of digits to theDigit | |
| end if |
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
| { iso(1) member-body(2) us(840) rsadsi(113549) | |
| pkcs(1) pkcs-9(9) smime(16) modules(0) msg-v3dot1(21) } | |
| DEFINITIONS IMPLICIT TAGS ::= | |
| BEGIN | |
| IMPORTS | |
| -- Cryptographic Message Syntax | |
| SubjectKeyIdentifier, IssuerAndSerialNumber, | |
| RecipientKeyIdentifier |
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 | |
| import base64 | |
| ct = 'EnCt22bbdc932ace27197eff234c409c2550cc882a4c92bbdc932ace27197eff234c4GMRUZdNqXgHr7zwU7FbknCNZzGy2Z143IJuZ3Q==IwEmS' | |
| ct = ct[5:] # trim 'EnCt2' header | |
| ct = ct[:-5] # trim 'IwEmS' footer | |
| hash = bytes.fromhex(ct[:64]) | |
| hmac = bytes.fromhex(ct[:40]) |
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
| def step_waves(waves): | |
| for i in xrange(len(waves)): | |
| if i + 1 < len(waves): | |
| waves[i] += waves[i+1] - 8 | |
| # This is almost modulo 15, but not quite | |
| if waves[i] > 15: | |
| waves[i] -= 15 | |
| elif waves[i] < 0: | |
| waves[i] += 15 |
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
| import itertools | |
| # Re-implementation of important methods from the VB code | |
| init_step_count = 1024 | |
| def step_waves(waves): | |
| for i in xrange(len(waves)): | |
| if i + 1 < len(waves): | |
| waves[i] += waves[i+1] - 8 |