Skip to main content
added 17 characters in body
Source Link
Phrancis
  • 20.5k
  • 6
  • 70
  • 155

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), 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.

//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?

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.

//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?

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.

//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?

Tweeted twitter.com/StackCodeReview/status/720583916965535744
Rollback to Revision 4
Source Link
Ben Aaronson
  • 5.8k
  • 22
  • 40

One-way hash in c#using ASCII

AAssume 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 using ascii, 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?

One-way hash in c#

A function that accepts a string, and produce a one way hash value from the string using ascii, and returns the hash value.

One-way hash using ASCII

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.

//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?

deleted 679 characters in body; edited title
Source Link
david
  • 171
  • 1
  • 7

One-way hash using ASCIIin c#

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 aA function that accepts a string, uses Ascii(c) and additional processing to produce a one way hash value from the string using ascii, 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?

One-way hash using ASCII

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.

//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?

One-way hash in c#

A function that accepts a string, and produce a one way hash value from the string using ascii, and returns the hash value.

edited tags
Link
200_success
  • 145.7k
  • 22
  • 191
  • 481
Loading
deleted 23 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Loading
deleted 13 characters in body
Source Link
Quill
  • 12.1k
  • 5
  • 41
  • 94
Loading
Source Link
david
  • 171
  • 1
  • 7
Loading