2

I know that the object refguess becomes 95^n characters long and that's what's being stored in the memory. Is it possible to load and iterate one element into memory at a time, erasing it before loading a new element? Eventually, I want to port this to run on a GPU to take advantage of the shader cores' superior number crunching ability, so a small RAM footprint would be optimal.

import itertools
import string

i = 1
refguess = ''
password = ' ~}}'
charlist = list(string.printable)
charlist = charlist[1:95]

while refguess != password:
    i += 1
    for idx, val in enumerate(list(itertools.product(charlist,repeat=i))):
        refguess = ''.join(map(str,val))
        if refguess == password:
            print('Password is ' + '(' + refguess + ')')
            break
4

1 に答える 1

0

Mark Ransom によって投稿された答えは、リストを作成する必要がないときにリストを作成していたというものでした。

ありがとうございました!

于 2012-10-02T22:16:58.517 に答える