Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions