Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@joshschmelzle
Last active April 1, 2021 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshschmelzle/463d28fb878e119d8c6baf5b06b4c395 to your computer and use it in GitHub Desktop.
Save joshschmelzle/463d28fb878e119d8c6baf5b06b4c395 to your computer and use it in GitHub Desktop.
Cisco Scrypt Secret 9 Generator Attempt - YMMV
import base64
import scrypt
import os
import random
# password
password = "hashcat"
# translation table
base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
cisco64chars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
table = str.maketrans(base64chars, cisco64chars)
# salt
chars=[]
for i in range(14):
chars.append(random.choice(cisco64chars))
salt = "".join(chars)
hash = scrypt.hash(password.encode(), salt.encode(), 16384, 1, 1, 32)
data = base64.b64encode(hash, altchars=b"-_")
#data = base64.b64encode(hash, altchars=b"-_")
# encode the hash
hash = base64.b64encode(hash).decode().translate(table)[:-1]
print(f"$9${salt}${hash}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment