Link to home
Start Free TrialLog in
Avatar of DemonForce
DemonForce

asked on

SHA-256 HASH FOR EXCEL

Hi,

I need to protect a sheet of passwords using SHA-256 Hashing, I have working macro scripts for MD5 and SHA-1, I would like to implement SHA-256 but can not find any macro code to achieve this.
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DemonForce
DemonForce

ASKER

Hi

Thank you for that, I imported into Excel as a class module, and tried to call the function sha256, which shows #REF ?
ah, so you're using it in a formula. Add this to a regular module:
Public Function SHA256Hash(strInput As String)
    Dim oSHA256 As CSHA256
    Set oSHA256 = New CSHA256

    SHA256Hash = oSHA256.SHA256(strInput)

    Set oSHA256 = Nothing
End Function

Open in new window


In a formula:
=SHA256Hash("Test")

Open in new window

or
=SHA256Hash(A1)

Open in new window

Perfect, thanx :)