ranjith2523
Board Regular
- Joined
- Apr 29, 2014
- Messages
- 137
- Office Version
- 365
Hi Friends,
This question is not related to Excel or VBA but my senior told that the peoples who have knowledge on VBA can answer this question. I have little VBA knowledge but I didn't try to find solution for his question.
Can someone please help me to understand the below question (also give me a little simple explanation about this question in easy understandable English) and find out the solution ? Thanks for all your help in advance.
Question:
Find out the input string that was passed to the following hash function
Integer Hash (String inputString)
Integer outputNumber = 7;
String letters = "acdegilmnoprstuw";
Integer index = 0;
Integer lengthOfInputString = inputString.Length;
while (index < lengthOfInputString)
{
outputNumber = (outputNumber* 37+ letters.IndexOf (inputString
[index]));
index = index + 1;
}
return outputNumber;
}
That produced the hashed output (integer value) as
945901726134069
Provided, the input string length was 9 and contains only characters
from the below string
"acdegilmnoprstuw"
Note: You need to reverse engineer the above hash logic and find out the
answer.
HELP:
String - a data type that holds collection of characters, an array of
characters with zero- based index. Hash - Modify an input value to a
different one using which one cannot easily find out the original value.
Dehash - Find the original input value that was modified by hashing.
Function - a code snippet that accepts zero or more number of input
parameters and return either no value or a value. Integer - a data type
that holds both positive and negative full numbers.
<string_variable>.IndexOf - an in-built function in any programming
language that finds out the starting index of any substring (one or more
characters together) inside the value stored in string_variable.
<string_variable>[<integer_variable>] - an expression that returns the
character at the-index specified by the value of integer_variable
This question is not related to Excel or VBA but my senior told that the peoples who have knowledge on VBA can answer this question. I have little VBA knowledge but I didn't try to find solution for his question.
Can someone please help me to understand the below question (also give me a little simple explanation about this question in easy understandable English) and find out the solution ? Thanks for all your help in advance.
Question:
Find out the input string that was passed to the following hash function
Integer Hash (String inputString)
Integer outputNumber = 7;
String letters = "acdegilmnoprstuw";
Integer index = 0;
Integer lengthOfInputString = inputString.Length;
while (index < lengthOfInputString)
{
outputNumber = (outputNumber* 37+ letters.IndexOf (inputString
[index]));
index = index + 1;
}
return outputNumber;
}
That produced the hashed output (integer value) as
945901726134069
Provided, the input string length was 9 and contains only characters
from the below string
"acdegilmnoprstuw"
Note: You need to reverse engineer the above hash logic and find out the
answer.
HELP:
String - a data type that holds collection of characters, an array of
characters with zero- based index. Hash - Modify an input value to a
different one using which one cannot easily find out the original value.
Dehash - Find the original input value that was modified by hashing.
Function - a code snippet that accepts zero or more number of input
parameters and return either no value or a value. Integer - a data type
that holds both positive and negative full numbers.
<string_variable>.IndexOf - an in-built function in any programming
language that finds out the starting index of any substring (one or more
characters together) inside the value stored in string_variable.
<string_variable>[<integer_variable>] - an expression that returns the
character at the-index specified by the value of integer_variable