Is the a way to convert a hashstring to a normal string

1
In need to compare a password with a normal string, how do i convert a hashString back to a normal string?
asked
4 answers
6

You can't, that's the whole point of a hashstring. For more info see wikipedia

If you want to compare a string with a hashed value, you should perform the same hashing function on the string, then see if the two hashed values are the same.

answered
4

Password hashes are generated by one-way (or trapdoor) algorithms. This means you can turn a string into a hash but not the other way around.

This is a common practice for storing passwords. If you only store the hash you can check the password a user enters by running it through the trapdoor function and comparing the resulting hash with the hash you've stored. If they match you know that the password is correct and you never have to store the password itself.

answered
4

To compare the hashstring with your string you need to use the verifyValue function on MendixHashString.

so in a java action you should do something like this:

    IMendixObject object = Parameter.getMendixObject();     
    MendixHashString hash = (MendixHashString) object.getMember(getContext(), Entity.MemberNames.Hash.toString());
    return hash.verifyValue(getContext(), MyString );

where 'Parameter' is an 'Entity' with an attribute 'Hash'

answered
-1

If you find a way, you will be very rich :-D. They are supposed to be inconvertible.

answered