File Finger Print - support SHA-256

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

File Finger Print - support SHA-256

Post by IdeasVacuum »

Result$ = FileFingerprint(Filename$, Plugin [, Bits [, Offset [, Length]]])

So many download sites are now using SHA-256 file finger prints, it would be good to catch up since the likes of MD5 and SHA-1 were 'broken' long ago.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: File Finger Print - support SHA-256

Post by Mijikai »

PB supports up to 512 Bits?
Optional:
viewtopic.php?t=77330
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: File Finger Print - support SHA-256

Post by STARGÅTE »

https://www.purebasic.com/documentation ... print.html
Bits (optional) The bits number to use for the fingerprint. It is only supported for the following plugin:
#PB_Cipher_SHA2 : can be 224, 256 (default), 384 or 512.
#PB_Cipher_SHA3 : can be 224, 256 (default), 384 or 512.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: File Finger Print - support SHA-256

Post by IdeasVacuum »

Hi
#PB_Cipher_SHA3 : can be 224, 256 (default), 384 or 512.
That doesn't make SHA-3 become SHA-256 though?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: File Finger Print - support SHA-256

Post by STARGÅTE »

I don't know what you mean.
There are three SHA generations: SHA-1, SHA-2, and SHA-3.
The generation SHA-2 splits into SHA-224, SHA-256, SHA-384 and SHA-512, depending on the used bits.

So, what you mean with SHA-256 is just:

Code: Select all

FileFingerprint(FileName, #PB_Cipher_SHA2, 256)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply