I'm building a website. I have an API which takes 2 parameters: delete_user(user_id, hash).
And there is method to evaluate hash using SHA512:
String hash(String user_id)
{
String key = "23jfk3jf...343fk";
return SHA512(user_id + SHA512(key));
}
And the second method to validate:
bool validate(String user_id, String hash)
{
if(hash(user_id) == hash)
{
return true;
}
else return false;
}
- Every user knows his user_id and the hash value of his user_id.
- user_id has length K symbols
- the key in hash method has M symbols
- hash method is not public to users, but validate method is.
Is it hard for a user to find any pair (String user_id, String hash), for which validate will return true (of course, user_id is not his own account's user_id). Let's say K = 10 and M = 50?