Ejemplo n.º 1
0
 def scrypt_func(data):
     """Scrypt function simplification"""
     scrypt.hash(data.encode("ascii"),
                 salt=b"",
                 N=16384,
                 r=8,
                 p=8,
                 dkLen=32)
Ejemplo n.º 2
0
def scrypt_hash_addon(main_secret: str, name: str) -> bytes:
    """
    """
    from scrypt import scrypt

    return scrypt.hash(main_secret.encode("utf-8"),
                       name.encode("utf-8"),
                       N=2,
                       r=8,
                       p=1)
Ejemplo n.º 3
0
def scrypt_hash_passphrase(passwd, salt, hash_preset, buflen=32):

    # Buflen arg is for brainwallets only, which use this function to generate
    # the seed directly.
    N, r, p = get_hash_params(hash_preset)
    if type(passwd) == str: passwd = passwd.encode()

    try:
        assert not g.use_standalone_scrypt_module
        from hashlib import scrypt  # Python >= v3.6
        return scrypt(passwd,
                      salt=salt,
                      n=2**N,
                      r=r,
                      p=p,
                      maxmem=0,
                      dklen=buflen)
    except:
        import scrypt
        return scrypt.hash(passwd, salt, 2**N, r, p, buflen=buflen)
Ejemplo n.º 4
0
	def do_standalone_scrypt():
		import scrypt
		return scrypt.hash(passwd,salt,2**N,r,p,buflen=buflen)
Ejemplo n.º 5
-25
def scrypt_hash_passphrase(passwd,salt,hash_preset,buflen=32):

	# Buflen arg is for brainwallets only, which use this function to generate
	# the seed directly.
	N,r,p = get_hash_params(hash_preset)
	if type(passwd) == str: passwd = passwd.encode()

	try:
		assert not g.use_standalone_scrypt_module
		from hashlib import scrypt # Python >= v3.6
		return scrypt(passwd,salt=salt,n=2**N,r=r,p=p,maxmem=0,dklen=buflen)
	except:
		import scrypt
		return scrypt.hash(passwd,salt,2**N,r,p,buflen=buflen)