Skip to content

Instantly share code, notes, and snippets.

@Javran
Created November 10, 2012 16:58
Show Gist options
  • Select an option

  • Save Javran/4051704 to your computer and use it in GitHub Desktop.

Select an option

Save Javran/4051704 to your computer and use it in GitHub Desktop.
....
f = file( "raw", "r" )
raw = f.read()
f.close()
secret = ''.join( map( lambda x:chr( int(x,2)) , map( lambda x: x.replace("____", "1111") , raw.split() ) ) ) + "="
import base64
g = file("sec", "wb")
g.write( base64.b64decode( secret ) )
g.close()
@upsuper

upsuper commented Nov 11, 2012

Copy link
Copy Markdown

When opening a file, it’s preferable to use open() instead of invoking this constructor directly.

Reference: file - Built-in Functinos

@Javran

Javran commented Nov 11, 2012

Copy link
Copy Markdown
Author

made this mistaken by accident, I thought it was "open" while typing "file" actually ...

p.s.: and surprisingly it did work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment