Code: Select all
I know its not much but wanted to give back something for all the help I have received:

; I named the executable "PBfingerprinter" But call it what you want.
Code: Select all
;following code assembled from bits and pieces found
;in help files, on PB forum and some very amateur efforts
;by Randy Walker -- Compiles OK on PB v6.11
UseCRC32Fingerprint()
UseMD5Fingerprint()
UseSHA1Fingerprint()
UseSHA2Fingerprint()
UseSHA3Fingerprint()
Global HWND11
#KB_Escape = #PB_Shortcut_Escape + 49152
#Window_11 = 0
#window_22 = 1
Enumeration
#Text_1_11
#Text_2_11
#Text_3_11
#Manual_11
#More_11
#finger_comment_22
#finger_ClipBrd_22
#finger_Browse_22
#finger_Result_22
#finger_md5_22
#finger_crc_22
#finger_sha1_22
#finger_sha2_22
#finger_sha3_22
#fontAri8
#fontAri8B
#fontAri10B
#fontAri12B
#fontCur12B
EndEnumeration
Debug #fontAri12B
LoadFont(#fontAri8,"Arial",8)
LoadFont(#fontAri8B,"Arial",8,#PB_Font_Bold)
LoadFont(#fontAri10B,"Arial",8,#PB_Font_Bold)
LoadFont(#fontAri12B,"Arial",12, #PB_Font_Bold)
LoadFont(#fontCur12B,"Courier",12, #PB_Font_Bold)
;LoadFont(#fontCur12B,"Courier",12, #PB_Font_Bold)
StandardFile$ = "C:\XferTemp\" ; set initial file+path to display
Pattern$ = "All files (*.*)|*.*"
Pattern = 0 ; use the first of the three possible patterns as standard
If OpenWindow(#window_22,0,0,755,80,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
;
fingername$ = ProgramParameter()
If fingername$
fingerUpdate = #True
EndIf
;
TextGadget(#finger_comment_22, 15, 30,220,20,"")
SetGadgetFont(#PB_Default,FontID(#fontAri8B))
ButtonGadget(#finger_ClipBrd_22, 290, 30, 80,20,"` - - > Clipboard")
ButtonGadget(#finger_Browse_22, 376, 30, 50,20,"Browse")
SetGadgetFont(#PB_Default,FontID(#fontAri12B))
;Next Line Is Output Field
TextGadget(#finger_Result_22, 8,5,740,20,"Drag a file in here or click Browse" + Result$,#PB_Text_Border)
SetGadgetFont(#PB_Default,FontID(#fontAri8B))
OptionGadget(#finger_md5_22,10,53,60,20,"MD5sum")
OptionGadget(#finger_crc_22,86,53,60,20,"CRC32")
OptionGadget(#finger_sha1_22,153,53,60,20,"SHA1")
OptionGadget(#finger_sha2_22,213,53,60,20,"SHA2")
OptionGadget(#finger_sha3_22,273,53,60,20,"SHA3")
HideGadget(#finger_ClipBrd_22, 1)
EnableWindowDrop(#window_22, #PB_Drop_Files, #PB_Drag_Copy)
SetWindowTitle(#window_22, " Fingerprint Calculator")
SetGadgetText(#finger_comment_22," Select the desired fingerprint type below.")
SetGadgetState(#finger_md5_22, 1) ; set MD5sum option as active one
finger.l = #finger_md5_22
HWND22=WindowID(#window_22)
AddKeyboardShortcut(#window_22, #PB_Shortcut_Escape, #KB_Escape)
Else
End
EndIf
;
Exe=RunProgram("wmic","cpu get name,currentclockspeed","",#PB_Program_Hide|#PB_Program_Open|#PB_Program_Read|#PB_Program_Error)
If Exe
While ProgramRunning(Exe)
If AvailableProgramOutput(Exe)
Output$=ReadProgramString(Exe) ;trash first (header) line
Output$=Left(ReadProgramString(Exe),5) ; Capture 2nd line
CPU = Val(LTrim(Output$)) ; retain first word only
EndIf
Wend
EndIf
;
Select CPU
Case 0 To 1600
size = 200000000
Case 1601 To 2500
size = 400000000
Case 3501 To 5000
size = 800000000
Default
size = 10000000000
EndSelect
Repeat
_mess = WaitWindowEvent()
;Debug _mess
Select _mess
Case #PB_Event_CloseWindow
HideWindow(#window_22,1)
Case #PB_Event_WindowDrop
Debug "dropped"
If GetGadgetState(#finger_md5_22) + GetGadgetState(#finger_crc_22) + GetGadgetState(#finger_sha1_22) + GetGadgetState(#finger_sha2_22) + GetGadgetState(#finger_sha3_22)
Files$ = EventDropFiles()
fingerName$ = StringField(Files$, 1, Chr(10))
fingerUpdate = #True
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case #finger_ClipBrd_22 ; "Button 1 clicked!"
Result$ = GetGadgetText(#finger_Result_22)
SetClipboardText(Trim(Result$))
Repeat : Until WindowEvent() = 0
Case #finger_Browse_22 ; "Button 2 clicked!"
fingerName$ = OpenFileRequester("Please choose file for " + fingerType$ + " test", StandardFile$, Pattern$, Pattern)
If fingerName$
fingerUpdate = #True
EndIf
Case #finger_md5_22, #finger_crc_22, #finger_sha1_22, #finger_sha2_22, #finger_sha3_22
finger.l = EventGadget()
Debug finger
Select finger
Case #finger_md5_22
fingerType$ = "md5sum"
Case #finger_crc_22
fingerType$ = "crc32"
Case #finger_sha1_22
fingerType$ = "sha1"
Case #finger_sha2_22
fingerType$ = "sha2"
Case #finger_sha3_22
fingerType$ = "sha3"
EndSelect
If fingerName$
fingerUpdate = #True
EndIf
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case #KB_Escape
_mess = #PB_Event_CloseWindow
;HideWindow(#window_22,1)
EndSelect
EndSelect
If fingerUpdate = #True
If FileSize(fingerName$) > size
Select MessageRequester(" Be Prepared To Wait", "You have selected a very large file for evavluation and this will take time." + Chr(10) + "A 1GB file may take 10 seconds To a Minute depending on" + Chr(10) + "CPU And hard drive performance." + Chr(10) + "" + Chr(10) + " Are you prepared To wait For this calculation?", #MB_OKCANCEL)
Case #IDOK
Case #IDCANCEL
fingerUpdate = #False
EndSelect
EndIf
If fingerUpdate = #True
title$ = GetFilePart(fingerName$)
SetWindowTitle(#window_22, " ''"+title$+"'' " + fingerType$ + " value is:")
Select finger
Case #finger_md5_22
Result$ = FileFingerprint(fingerName$,#PB_Cipher_MD5)
Case #finger_crc_22
Result$ = FileFingerprint(fingerName$,#PB_Cipher_CRC32)
Case #finger_sha1_22
Result$ = FileFingerprint(fingerName$,#PB_Cipher_SHA1)
Case #finger_sha2_22
Result$ = FileFingerprint(fingerName$,#PB_Cipher_SHA2)
Case #finger_sha3_22
Result$ = FileFingerprint(fingerName$,#PB_Cipher_SHA3)
EndSelect
If Result$ = ""
Result$ = "Unknown error (possibly a locked file)"
Else
Result$=UCase(result$)
EndIf
StandardFile$ = GetPathPart(fingerName$) + "\"
HideGadget(#finger_ClipBrd_22, 0)
SetGadgetText(#finger_comment_22,"Match value above to the documented value.")
SetGadgetText(#finger_Result_22," " + Result$)
Debug "Got this far"
fingerUpdate = #False
EndIf
EndIf
Until _mess = #PB_Event_CloseWindow
fingername$ = ProgramParameter()
fingerUpdate = #True
[TIP] do Winkey + R and type shell:sendto
Press enter and add a shortcut pointing to your PBfingerprinter program.
Now you can right ckick any file, select [Send To] > [PBfingerprinter]
and get the fingerrprint value for your send to file

Very handy if you download a lot of ISO files.
[EDIT] 08/29/24 -- I cleaned up the "Be Prepared To Wait" comment.
[EDIT] 09/12/24 -- "Be prepared to wait" comment augmented by Values determined in the Select CPU section. Maybe someone can suggest better means of adjustment.
[EDIT] 09/17/24 app was opening showing immediate error, so I changed this line:
Code: Select all
fingerUpdate = #True
Code: Select all
If fingername$
fingerUpdate = #True
EndIf