I need to probe if a given String matches a scrypt key.
Some examples that need to match:
$s0$e0801$epIxT/h6HbbwHaehFnh/bw==$7H0vsXlY8UxxyW/BWx/9GuY7jEvGjT71GFd6O4SZND0=
$s0$100808$6McCjsQBpcCShLWq4nl3gg==$gs+Tz5DLGCDtYHGpIkP4i3EDpufBzsEGvoXzegkO5cU=
I use Javas String.matches
function.
The description of the Keys is like this: Basic form: $s0$params$salt$key
The values stand for:
This is the best I could come up with. Any better answer is greatly appreciated.
Java:
String match = "^\\$s0\\$[0-9a-f]{5,6}\\$[a-zA-Z0-9/+]+[=]*\\$[a-zA-Z0-9/+]+[=]*$"
General:
^\$s0\$[0-9a-f]{5,6}\$[a-zA-Z0-9/+]+[=]*\$[a-zA-Z0-9/+]+[=]*$
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments