Assume the built-in function Ascii(c), where c is a one character string, will return an integer containing the ASCII value of that character. Write a function that accepts a string, uses Ascii(c) and additional processing to produce a one way hash value from the string, and returns the hash value as a string. You may assume the initial string is not empty and contains several characters.
Assume the built-in function
Ascii(c), wherecis a one character string, will return an integer containing the ASCII value of that character. Write a function that accepts a string, usesAscii(c)and additional processing to produce a one way hash value from the string, and returns the hash value as a string. You may assume the initial string is not empty and contains several characters.
//one way hash using ascii static string hashViaAscii(String S) { int hashVal = 0; for (int k = 0; k < S.Length; k++) hashVal += Ascii(S[k]); //gets Ascii value, add them all return ((hashVal % HASH_TABLE_SIZE).ToString()); //return sum % table size as string } I don't think is a good approach. How can this be improved?