Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a JS regex to match a sha256 word hash within a text? [duplicate]

On the following text

MD5 ed076287532e86365e841e92bfc50d8c
SHA1 2ef7bde608ce5404e97d5f042f95f89f1c232871
SHA256 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069 
ssdeep3:aBn:aB 
File size 12 bytes ( 12 bytes ) 
File type Text 
Magic literal ASCII text, with no line terminators 
TrID    Unknown!

I want to match the hash the SHA256 value in JS:

7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069 
like image 473
Ricardo Avatar asked Mar 10 '23 06:03

Ricardo


1 Answers

The following regex works for me:

\b[A-Fa-f0-9]{64}\b

Check the explanation here: https://regex101.com/r/AXhQLz/1

like image 154
Ricardo Avatar answered Mar 12 '23 04:03

Ricardo