Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import crypt
import sys
import random
saltchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
def salt():
return "$6$" + "".join(random.sample(saltchars, 8))
@stiandre
stiandre / example.py
Created January 28, 2013 11:34
python-magic (libmagic python bindings)
#!/usr/bin/env python
# Install (ubuntu/debian):
# ------------------------
# apt-get install python-magic
import magic
ms = magic.open(magic.MAGIC_NONE)
ms.load()