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.
Microsoft ExcelMicrosoft Applications

Avatar of undefined
Last Comment
DemonForce
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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 ?
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

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

Avatar of DemonForce
DemonForce

ASKER

Perfect, thanx :)
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo