I am looking to find bcrypt hash string using regex (in PowerGrep), in a database.
Tried this regex:
{?A-Za-z_0-9.{60}}?
But no match w
According to Wikipedia, bcrypt hashes follow the following format:
$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
\__/\/ \____________________/\_____________________________/
Alg Cost Salt Hash
Where valid values for each segment are:
2, 2a, 2b, 2x or 2y./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ x 22./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ x 31Therefore, a comprehensive regex would look something like the following:
^[$]2[abxy]?[$](?:0[4-9]|[12][0-9]|3[01])[$][./0-9a-zA-Z]{53}$