Simple Password Strength Checker with PWned Online Check (1 Viewer)

Hi Jason
For info:
I tested this whilst my version of Office was temporarily set to Spanish language
The code then caused 6 repeated errors (1 for each image) on the line:
Code:
If Left(ctrl.Name, 5) = "Image" Then ctrl.Visible = False

Disabling the line solved the issue. Of course, it runs fine in English and I will look at the code later
If time, I may mention this app in a presentation I'm doing on security in Access databases later today
 
Hi Jason,
I think there are 5 missing attached images. These are the errors in Spanish:
From Pass1of5.bmp to Pass5of5.bmp
1761671042539.png

1761671077546.png

...
1761671126090.png
 
Last edited:
Hi Jason
For info:
I tested this whilst my version of Office was temporarily set to Spanish language
The code then caused 6 repeated errors (1 for each image) on the line:
Code:
If Left(ctrl.Name, 5) = "Image" Then ctrl.Visible = False

Disabling the line solved the issue. Of course, it runs fine in English and I will look at the code later
If time, I may mention this app in a presentation I'm doing on security in Access databases later today

That's because of this code: -
Code:
Dim bytArr() As Byte
bytArr = sPW
For i = 0 To UBound(bytArr) Step 2
    Select Case bytArr(i)

This assumes each character is represented by a single byte, which is true for ASCII but not for Unicode characters. Some characters in Spanish are multi-byte in Unicode therefore the loops skip every 2nd byte.

Just replace with this sub and will be compatible: -

Code:
Sub GetPasswordStats(sPW As String, ByRef lNum As Long, ByRef lU As Long, ByRef lL As Long, ByRef lS As Long)
    Dim i As Long, ch As String, code As Long
    For i = 1 To Len(sPW)
        ch = Mid$(sPW, i, 1)
        code = AscW(ch)
        Select Case code
            Case 48 To 57: lNum = lNum + 1
            Case 65 To 90: lU = lU + 1
            Case 97 To 122: lL = lL + 1
            Case 33 To 47, 58 To 64, 91 To 96, 123 To 126, 161 To 191, 209, 241: lS = lS + 1 ' include extended punctuation and ñ
        End Select
    Next
End Sub
 
Hi Jason,

After replacing the GetPasswordStats code the image issue seems to have been cured.

However after entering a Password and pressing the Check HIBP for Online Breaches I get the following:

ksnip_20251028-210849.jpg


ksnip_20251028-210853.jpg
 
not all have the same Net Framework as you have.
 
Hi Jason,

After replacing the GetPasswordStats code the image issue seems to have been cured.

However after entering a Password and pressing the Check HIBP for Online Breaches I get the following:

View attachment 122012

View attachment 122013

As arnelgp mentioned, that line relies on the .NET Framework exposing the SHA1 class as a COM object — which isn’t guaranteed on every machine. It’ll usually work if the full .NET Framework is installed (not just .NET Core or .NET 5+), but if it’s missing or incomplete, you’ll hit a generic .NET exception because the object can’t be created.

To sidestep that issue, you could switch to a pure VBA SHA1 implementation. Since I’m already using MSXML2.XMLHTTP, dropping in a native VBA version avoids the .NET dependency altogether.

I don’t personally need it to be .NET-free, but it’s an easy tweak. If there’s enough interest, I’ll clean it up and share it.
 

Users who are viewing this thread

Back
Top Bottom