Beispiel #1
0
def tryDecrypt(p, k, s, a):
        plainPage = []
        count = 0
        for word in pages[p]:
                plainWord = []
                for char in word:
                        key = rkeys.allKeys[k]
                        newChar = rappls.allAppls[a](char, key[count % len(key)], s)
                        plainWord.append(newChar)
                        #print str(char) + " = " + str(newChar)
                        count += 1
                plainPage.append(plainWord)

        print [gemprim.ascToStr(gemprim.primeToAsc(gemprim.intToPrime(word))) for word in plainPage]
Beispiel #2
0
def getEng(page):
        txtPage = [gemprim.primeToAsc(gemprim.intToPrime(word)) for word in page] 
        engPage = []
        
        for word in txtPage:
                curWord = ""
                for letter in word:
                        for c in letter:
                                if c == "/":
                                        break
                                curWord += c
                engPage.append(curWord.lower())
        
        correct = 0
        for word in engPage:
                if word != '' and len(word) > 1 and eng.check(word):
                        correct += 1
                        if len(word) > 6:
                                print word
                        #print word
                if word in ["pilgrim", "instar", "fibonacci", "prime", "primes", "emerge", "cicada", "onion", "sacred"]:
                        print word
Beispiel #3
0
sys.exit()

hashPage = [gemprim.primeToInt(i) for i in hashPage]
plainPage = []

count = 0
for word in hashPage:
    plainWord = []
    for c in word:
        plainWord.append((c - primes[count] + 1) % 29)
        count += 1

    plainPage.append(plainWord)

print [gemprim.primeToRune(gemprim.intToPrime(word)) for word in hashPage]
print [gemprim.ascToStr(gemprim.primeToAsc(gemprim.intToPrime(word))) for word in plainPage]


# Get freq of every page
# for ip in range(len(pages)):
#         print "Page " + str(ip) + ":"
#         page = pages[ip]
#         runes = []
#         for word in page:
#                 runes.extend([gemprim.primeToAsc([c])[0] for c in word])
#         dstats.graphFreq(runes)
#         raw_input("...")

### Results:
### Every page has variation in frequencies