We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Basic hash retriever
#1
This is for the safety guaranteed for the file integrity kingdom of Windows.

ID: QQNW492.000
Link: https://smallbasic.com/program/?QQNW492.000
Requires: LitDev 1.2.30.0 Beta or higher, Small Basic 1.2 (web download version, 1.3 is UWP and doesn't support libs)

Code:
main()

Sub main
  TextWindow.Hide()
  path = LDDialogs.InputBox("Get a MD5 hash of a file. Use 'dialog' to open a file selection dialog instead.", "Hash Retriever")
  If path = "dialog" Then
    getFile = LDDialogs.OpenFile("All files (*.*)|*.*", "")
    retrievedHash = LDEncryption.MD5HashFile(getFile)
    showHash()
  Else
    retrievedHash = LDEncryption.MD5HashFile(path)
    showHash()
  EndIf
EndSub

Sub showHash
  TextWindow.Hide()
  TextWindow.Title = ""
  TextWindow.Show()
  TextWindow.WriteLine("MD5 Hash: "+retrievedHash)
  TextWindow.Write("Retrieve another hash? (Y/N) ")
  getYorN = TextWindow.Read()
  If getYorN = "y" Then
    main()
  ElseIf getYorN = "n" Then
    Program.End()
  EndIf
EndSub

Feel free to expand or to bundle in your own SB apps!
[-] The following 1 user Likes sm4llprogrammer2008's post:
  • AbsoluteBeginner
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)