Question: import os import hashlib def get_salt(): Returns the appropriate salt for assum salt id is 'abcdefg' :rtype: bytes # Hint: use os.environment and bytes.fromhex

import os import hashlib def get_salt(): """Returns the appropriate salt for assum salt id is 'abcdefg' :rtype: bytes """

# Hint: use os.environment and bytes.fromhex raise NotImplementedError()

def hash_str(some_val, salt=''): """Converts strings to hash digest See: https://en.wikipedia.org/wiki/Salt_(cryptography) :param str or bytes some_val: thing to hash :param str or bytes salt: string or bytes to add randomness to the hashing, defaults to ''. :rtype: bytes """ raise NotImplementedError()

def get_user_id(username): salt = get_csci_salt() return hash_str(username.lower(), salt=salt).hex()[:8]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!