I'm planning to place a new function on my Switchboard, and I'd like this choice to require a password in order to get into it. What's the best way to do this? (Or, more accurately, any way to accomplish the goal of not having to create separate-but-almost-equal front end copies!)
In line with what Rabbit stated in Post #4, here is some Code that will perform exactly as you requested: - Public Function fOpenForm()
-
Dim strMsg As String
-
Dim strResponse As String
-
Const conPASSWORD As String = "ZeBrA"
-
-
strMsg = "A Password is required in order to Open the YaDa-YaDa Form." & _
-
vbCrLf & vbCrLf & "Enter the Password in the space provided below, " & _
-
"being advised that the Password is Case Sensitive."
-
-
strResponse = InputBox$(strMsg, "Password Prompt")
-
-
If strResponse = "" Then Exit Function 'Cancel or OK with no entry
-
-
'Look for an 'exact match' to ZeBrA (Case Sensitive)
-
If StrComp(conPASSWORD, strResponse, vbBinaryCompare) = 0 Then
-
'Open Form here
-
Else
-
MsgBox "The Password you entered (" & strResponse & ") is not correct!", _
-
vbCritical, "Incorrect Password"
-
Err.Clear
-
End If
-
End Function
P.S. - You can definitely add another layer of Security in order to Protect your Code and Project, by: - In any Code Window:
- Tools ==> 'Project Name' & Properties
- Protection Tab ==> Select lock project for viewing
- Enter Password and Confirm same
- DO NOT FORGET THE PASSWORD YOU USED TO LOCK YOUR CODE!
- Any questions, we are here.
- You can also download the Attachment to see how it all works.
26 3430
Any way to do it would be to use an InputBox in the function to ask for a password and then comparing the input to the password. This is extremely insecure though. As anyone with some Access knowledge can just look in the code for the password or bypass it. Making the database an MDE or ACCDE would make it a lot more secure but anytime you store the password with the client is a security hole. You could, instead, compare password hashes.
Regardless of how much you protect this function, if they have access to the data directly, they can backwards engineer whatever your password protected function is doing.
I am blessed with users that are both cooperative and fairly unsophisticated. I just want to help guide them down the right path, and this new function is something that only a few of them need to worry about.
I just need some specifics on how I would add this kind of thing to a particular option in my Access Switchboard.
You wouldn't put it in the switchboard per se. You would put it in the function that the switchboard is calling.
In line with what Rabbit stated in Post #4, here is some Code that will perform exactly as you requested: - Public Function fOpenForm()
-
Dim strMsg As String
-
Dim strResponse As String
-
Const conPASSWORD As String = "ZeBrA"
-
-
strMsg = "A Password is required in order to Open the YaDa-YaDa Form." & _
-
vbCrLf & vbCrLf & "Enter the Password in the space provided below, " & _
-
"being advised that the Password is Case Sensitive."
-
-
strResponse = InputBox$(strMsg, "Password Prompt")
-
-
If strResponse = "" Then Exit Function 'Cancel or OK with no entry
-
-
'Look for an 'exact match' to ZeBrA (Case Sensitive)
-
If StrComp(conPASSWORD, strResponse, vbBinaryCompare) = 0 Then
-
'Open Form here
-
Else
-
MsgBox "The Password you entered (" & strResponse & ") is not correct!", _
-
vbCritical, "Incorrect Password"
-
Err.Clear
-
End If
-
End Function
P.S. - You can definitely add another layer of Security in order to Protect your Code and Project, by: - In any Code Window:
- Tools ==> 'Project Name' & Properties
- Protection Tab ==> Select lock project for viewing
- Enter Password and Confirm same
- DO NOT FORGET THE PASSWORD YOU USED TO LOCK YOUR CODE!
- Any questions, we are here.
- You can also download the Attachment to see how it all works.
As always, ADezii, your answer is beautifully complete and clear--thanks!
(in fact, I'm tempted to call the new function the "ADezii YaDa-YaDa Module". it has a certain ring.)
(in fact, I'm tempted to call the new function the "ADezii YaDa-YaDa Module". it has a certain ring.)
It does have a certain ring, that YaDa-YaDa! (LOL). BTW, how did you make out with Locking your Code? Personally, I find it a very useful tool, and no one, to the best of my knowledge, has ever gotten to any Code and modified it.
Locking the code will prevent easy editing of the code but I am still able to open the database in notepad and find the password that way. Should use a hash instead if that's a concern.
ADezii, I haven't put in the code-locking password yet, but I was wondering: if I expand this function at all, I'm going to want it to have its own little switchboard. I'm going to post a separate question: "How do I call a switchboard from within a code module?"
Your advice is, of course, the optimal solution. I was simply going by what the OP stated in Post #3, namely:
I am blessed with users that are both cooperative and fairly unsophisticated. I just want to help guide them down the right path, and this new function is something that only a few of them need to worry about.
- As far as viewing the DB by External Editors, couldn't the Database be Encrypted if that is a concern?
- Can you kindly demonstrate the use of the 'Hash' Technique for Password Security. I would be interested in seeing it, as I'm sure sueb would also. Thanks.
Yes, I, too, would like to see the higher security solution. It's not inconceivable that in the future my database may have a wider (and less reliable) user base.
Yes, you could encrypt it. Or you could create a compiled version of the database by converting it to an MDE or ACCDE depending on what version of Access you have.
There are many hashing algorithms but I will show you the SHA2 256-bit algorithm as I have that handy. It takes a string, hashes it, and returns the result as a 32 item array containing the hashed value. This code was written for VBScript but is probably directly translatable into VBA. - Function SHA(ByVal sMessage)
-
Dim i, result(32), temp(8), fraccubeprimes, hashValues
-
Dim done512, index512, words(64), index32, mask(4)
-
Dim s0, s1, t1, t2, maj, ch
-
-
mask(0) = 4294967296
-
mask(1) = 16777216
-
mask(2) = 65536
-
mask(3) = 256
-
-
hashValues = Array( _
-
1779033703, 3144134277, 1013904242, 2773480762, _
-
1359893119, 2600822924, 528734635, 1541459225)
-
-
fraccubeprimes = Array( _
-
1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, _
-
3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, _
-
3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, _
-
2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, _
-
666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, _
-
2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, _
-
430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, _
-
1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298)
-
-
sMessage = sMessage & Chr(128)
-
done512 = False
-
index512 = 0
-
-
If (Len(sMessage) Mod 64) <> 0 Then
-
For i = (Len(sMessage) Mod 64) To 63
-
sMessage = sMessage & Chr(0)
-
Next
-
End If
-
-
Do Until done512
-
For i = 0 To 15
-
words(i) = CDbl( "&h" & _
-
Right("0" & Hex(Asc(Mid(sMessage, i*4 + 1, 1))), 2) & _
-
Right("0" & Hex(Asc(Mid(sMessage, i*4 + 2, 1))), 2) & _
-
Right("0" & Hex(Asc(Mid(sMessage, i*4 + 3, 1))), 2) & _
-
Right("0" & Hex(Asc(Mid(sMessage, i*4 + 4, 1))), 2))
-
Next
-
-
For i = 16 To 63
-
s0 = largeXor(largeXor(rightRotate(words(i-15), 7, 32), rightRotate(words(i-15), 18, 32), 32), Int(words(i-15) / 8), 32)
-
s1 = largeXor(largeXor(rightRotate(words(i-2), 17, 32), rightRotate(words(i-2), 19, 32), 32), Int(words(i-2) / 1024), 32)
-
words(i) = words(i-16) + s0 + words(i-7) + s1
-
Next
-
-
For i = 0 To 7
-
temp(i) = hashValues(i)
-
Next
-
-
For i = 0 To 63
-
s0 = largeXor(largeXor(rightRotate(temp(0), 2, 32), rightRotate(temp(0), 13, 32), 32), rightRotate(temp(0), 22, 32), 32)
-
maj = largeXor(largeXor(largeAnd(temp(0), temp(1), 32), largeAnd(temp(0), temp(2), 32), 32), largeAnd(temp(1), temp(2), 32), 32)
-
t2 = s0 + maj
-
s1 = largeXor(largeXor(rightRotate(temp(4), 6, 32), rightRotate(temp(4), 11, 32), 32), rightRotate(temp(4), 25, 32), 32)
-
ch = largeXor(largeAnd(temp(4), temp(5), 32), largeAnd(largeNot(temp(4), 32), temp(6), 32), 32)
-
t1 = temp(7) + s1 + ch + fraccubeprimes(i) + words(i)
-
-
temp(7) = temp(6)
-
temp(6) = temp(5)
-
temp(5) = temp(4)
-
temp(4) = temp(3) + t1
-
temp(3) = temp(2)
-
temp(2) = temp(1)
-
temp(1) = temp(0)
-
temp(0) = t1 + t2
-
Next
-
-
For i = 0 To 7
-
hashValues(i) = Int(((hashValues(i) + temp(i)) / 4294967295 - Int((hashValues(i) + temp(i)) / 4294967295)) * 4294967295)
-
Next
-
-
If (index512 + 1) * 64 >= Len(sMessage) Then done512 = True
-
index512 = index512 + 1
-
Loop
-
-
For i = 0 To 31
-
result(i) = Int((hashValues(i\4) / mask(i Mod 4) - Int(hashValues(i\4) / mask(i Mod 4))) * 256)
-
Next
-
-
SHA = result
-
End Function
For this to work, it has to use 32-bit unsigned integers but seeing as how that is not available as a datatype in VBA, we have to use doubles instead. However, the XOR, AND, and NOT operators will overflow when using doubles. In addition to that, there is no bit shift operators or functions in VBA. So I had to create those. - Function rightRotate(value, amount, totalBits)
-
'To leftRotate, make amount = totalBits - amount
-
Dim i
-
rightRotate = 0
-
-
For i = 0 To (totalBits - 1)
-
If i >= amount Then
-
rightRotate = rightRotate + (int((value / (2 ^ (i + 1)) - int(value / (2 ^ (i + 1)))) * 2)) * 2 ^ (i - amount)
-
Else
-
rightRotate = rightRotate + (int((value / (2 ^ (i + 1)) - int(value / (2 ^ (i + 1)))) * 2)) * 2 ^ (totalBits - amount + i)
-
End If
-
Next
-
End Function
-
-
Function largeXor(value, xorValue, totalBits)
-
Dim i, a, b
-
largeXor = 0
-
-
For i = 0 To (totalBits - 1)
-
a = (int((value / (2 ^ (i + 1)) - int(value / (2 ^ (i + 1)))) * 2))
-
b = (int((xorValue / (2 ^ (i + 1)) - int(xorValue / (2 ^ (i + 1)))) * 2))
-
If a <> b Then
-
largeXor = largeXor + 2 ^ i
-
End If
-
Next
-
End Function
-
-
Function largeNot(value, totalBits)
-
Dim i, a
-
largeNot = 0
-
-
For i = 0 To (totalBits - 1)
-
a = int((value / (2 ^ (i + 1)) - int(value / (2 ^ (i + 1)))) * 2)
-
If a = 0 Then
-
largeNot = largeNot + 2 ^ i
-
End If
-
Next
-
End Function
-
-
Function largeAnd(value, andValue, totalBits)
-
Dim i, a, b
-
largeAnd = 0
-
-
For i = 0 To (totalBits - 1)
-
a = int((value / (2 ^ (i + 1)) - int(value / (2 ^ (i + 1)))) * 2)
-
b = (int((andValue / (2 ^ (i + 1)) - int(andValue / (2 ^ (i + 1)))) * 2))
-
If a = 1 And b = 1 Then
-
largeAnd = largeAnd + 2 ^ i
-
End If
-
Next
-
End Function
So instead of coding in a password. What you do is precalculate the hash of the password. When they enter in the password, you hash their input and compare it to the hash that you have stored. This way, even if they know what the result of the hash is, they do not know the original password that created the hash. It would be infeasible for them to calculate a password that would result in the same hash.
- Thanks Rabbit. I really haven't had time to take a long look at the Code, bot something immediately pops right up and stares at me. Why are all 23 Variables in the 3 Functions implicitly Declared as Variants? I can understand hashValues and fraccubesprimes since they are used in conjunction with Array(). Just seems very strange.
- Does this take into account Case-Sensitivity?
- What is the typical mechanism for storing the pre-calculated Hash Value?
1) Everything is implicitly a variant because this was written for VBScript and everything is a variant in VBScript. You can not define the type when declaring a variable.
2) Yes, this is case sensitive because it is using the ASCII numeric value in the calculations.
3) Normally you just store the hash "as is." Now, when it is done like this, it is insecure because someone can just change the hash value being compared to a hash they themselves calculate. However, when you lock the code in a project, any attempt to change it using outside editors will lock up the entire database. Access must use it's own hash check using the modified date attribute of the file, otherwise it would not be able to know that it was modified outside of the database. Because of this, they can see the hash value, but they can not change it and they can not feasibly calculate the password used to generate the hash.
On a side note, this is how linux based utilities reset Windows passwords. They overwrite the hash value that is stored with the user account. If security is an issue, what you should do is encrypt all the files of that user using the password. That way, even if they overwrite the hash and log in as that user, they can not view the files because they don't have the password to decrypt the data.
Hashes are often used in internet communication to authenticate messages. The sender will hash the original data and send it along with the encrypted data. The receiver will then decrypt the data and recalculate the hash from the unencrypted data. If the hashes match, then he is assured that the data was received as intended. If you were to send just the encrypted data, someone could conceivably intercept the message, flip a bit in the message, and pass it along. The receiver would never know the message was changed.
EDIT: I just realized encrypting the database doesn't work because you would have to give the user the password to decrypt it if they are going to use the database. And if they had that, they can resave the database as an unencrypted version and find the password using an outside editor. You would have to use a compiled version. Or you would have to lock the code and compare hashes. Or both.
Thanks Rabbit for a Crash Course on 'Hashing'.
No problem. If you're seeing the SHA2 algorithm for the first time, it's probably confusing as to what it's doing. But here's an extremely simple hash algorithm so you can see the essence of a hash. - Function SimpleHash(strMessage As String) As Byte
-
Dim i As Integer
-
-
SimpleHash = 0
-
For i = 1 To Len(strMessage)
-
SimpleHash = SimpleHash Xor Asc(Mid(strMessage, i, 1))
-
Next
-
End Function
This is an 8-bit hash. In essence, what a hash algorithm does is take data of any length and does mathematical transformations on it and returns a fixed length result. A change to the original data will result in a different hash of the same length. This is basically what the SHA2 algorithm does except it's a longer length and uses much more complex mathematical transformations.
Hello Rabbit. I was tinkering with your very interesting SHA() Function and found that it generates a Type Mismatch Error on the last line of the Function where it is assigned its Value, namely:
In the Declarations, result(32) is a Variant Array consisting of 32 Elements numbered 0 thru 31. If you assign the return Value of the Function equal to any Element of the result() Array, it will return the proper Value, as in: - SHA = result(7)
-
SHA = result(22)
-
SHA = result(19)
I would like to add this Functionality to my Code DB, but have to get through this hurdle. I am probably missing something very simple, but for now just can't figure out what the problem is. Any ideas?
Probably has something to do with the conversion from VBScript to VBA. I'll port it and take a look.
Prior to the Function terminating, result() is populated with 32 1-Byte Values as indicated in the Code below and the Sample Output. It would appear to me that some kind of Operation would have to be performed on these Byte Values, and the result assigned to the Function. Puzzling... - For i = 0 To 31
-
result(i) = Int((hashValues(i\4) / mask(i Mod 4) - Int(hashValues(i\4) / mask(i Mod 4))) * 256)
-
Next
-
-
SHA = result
- 85
-
119
-
251
-
236
-
125
-
254
-
150
-
150
-
247
-
183
-
191
-
103
-
251
-
242
-
186
-
246
-
191
-
93
-
122
-
72
-
126
-
166
-
149
-
67
-
201
-
176
-
3
-
29
-
103
-
103
-
26
-
221
Odd, the code worked for me without me having to change anything. What version of Access are you using? I'm using Access 2007.
Normally, the final step before it is displayed to the user is to convert the bytes to a hexadecimal format. So that what the user sees is along the lines of
0C 70 58 FA 4C 79 89 18 21 84 BE 45 9D 9A EB F4 11 B8 26 D4 6E 34 67 69 60 F4 C2 21 5E D5 ED F8
But when it is being used behind the scenes, where the user does not need to see the actual hash, there is no need for the extra conversion step.
The reason Hexadecimal is used for display instead of characters is because hashes don't always result in printable characters.
What version of Access are you using? I'm using Access 2007.
Access 2003
the final step before it is displayed to the user is to convert the bytes to a hexadecimal format.
Now I am really confused!(LOL). If I converted the 32 1-Byte Values in result(), concatenated them with a Space Delimiter, then assigned this String to the return Value of SHA(), would this represent a True Hash Value, as depicted below? -
'Code intentionally omitted
-
For i = 0 To 31
-
result(i) = Int((hashValues(i \ 4) / mask(i Mod 4) - Int(hashValues(i \ 4) / mask(i Mod 4))) * 256)
-
'Debug.Print result(i)
-
Next
-
-
Dim bytCtr As Byte
-
Dim strBuild As String
-
-
For bytCtr = 0 To 31
-
strBuild = strBuild & Hex$(result(bytCtr)) & " "
-
Next
-
-
'SHA = result
-
SHA = Trim(strBuild)
-
'Code intentionally omitted
-
Debug.Print SHA("Help") produces - CF 36 68 6E 8B 8C 2D 56 BD F0 A5 38 A5 57 81 D4 FC E0 1B 99 5C 49 6B 7F 37 7F 69 C3 F1 12 23 5B
P.S. - I still cannot see how you are getting valid Results in any Version of Access, since you are attempting to assign the return Value of SHA() to an Array of 1-Byte Values. I know I said this before, but Puzzling... If you figure this out, kindly let me know. Thanks Rabbit.
I attached a test database. You wouldn't change what the SHA function returns. However, you may format what the function returns differently depending on what you're doing. If I was going to display it, I would take the returned array and loop through and do the conversion at that point. But if I was going to store it, I would loop through and write the values as binary into a file.
As far as what constitutes a "true" hash value. As long as how it's represented can be converted back into it's numerical representation is fine.
It doesn't matter if I want to show the value 42 as the hexadecimal 2A, binary 00101010, or the character !. They are all equivalent.
@Rabbit - Thanks for sharing your expertise and for being so patient in this matter. It is greatly appreciated. I actually created a simple GUI for generating both 8 and 32 Bit Hash Values that I will share with you. In actual implementations, I would probably store the Hash Values as a Space Delimited, Hex String, in the System Registry, but I'm really not sure on this. Thanks again, it was truly a learning experience. Now, I only have to hope that NeoPa does not holler at me for getting Off-Topic! (LOL).
I don't know that I would ever use an 8-bit hash lol. It was more for demonstration. An 8-bit hash is too easy to break. Also, the SHA2 algorithm I posted is a 256-bit hash, not a 32-bit.
I got around to validating my output and it turns out that my code was a little off. Here's the corrected version. I validated the output against official SHA2 hashes. It's just a couple of changes. I forgot to do a 2^32 mod when I was adding numbers and I forgot to append the message size to the end of the message. - Function SHA(ByVal sMessage)
-
Dim i, result(32), temp(8) As Double, fraccubeprimes, hashValues
-
Dim done512, index512, words(64) As Double, index32, mask(4)
-
Dim s0, s1, t1, t2, maj, ch, strLen
-
-
mask(0) = 4294967296#
-
mask(1) = 16777216
-
mask(2) = 65536
-
mask(3) = 256
-
-
hashValues = Array( _
-
1779033703, 3144134277#, 1013904242, 2773480762#, _
-
1359893119, 2600822924#, 528734635, 1541459225)
-
-
fraccubeprimes = Array( _
-
1116352408, 1899447441, 3049323471#, 3921009573#, 961987163, 1508970993, 2453635748#, 2870763221#, _
-
3624381080#, 310598401, 607225278, 1426881987, 1925078388, 2162078206#, 2614888103#, 3248222580#, _
-
3835390401#, 4022224774#, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, _
-
2554220882#, 2821834349#, 2952996808#, 3210313671#, 3336571891#, 3584528711#, 113926993, 338241895, _
-
666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350#, 2456956037#, _
-
2730485921#, 2820302411#, 3259730800#, 3345764771#, 3516065817#, 3600352804#, 4094571909#, 275423344, _
-
430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, _
-
1955562222, 2024104815, 2227730452#, 2361852424#, 2428436474#, 2756734187#, 3204031479#, 3329325298#)
-
-
sMessage = Nz(sMessage, "")
-
strLen = Len(sMessage) * 8
-
sMessage = sMessage & Chr(128)
-
done512 = False
-
index512 = 0
-
-
If (Len(sMessage) Mod 60) <> 0 Then
-
For i = (Len(sMessage) Mod 60) To 59
-
sMessage = sMessage & Chr(0)
-
Next
-
End If
-
-
sMessage = sMessage & Chr(Int((strLen / mask(0) - Int(strLen / mask(0))) * 256))
-
sMessage = sMessage & Chr(Int((strLen / mask(1) - Int(strLen / mask(1))) * 256))
-
sMessage = sMessage & Chr(Int((strLen / mask(2) - Int(strLen / mask(2))) * 256))
-
sMessage = sMessage & Chr(Int((strLen / mask(3) - Int(strLen / mask(3))) * 256))
-
-
Do Until done512
-
For i = 0 To 15
-
words(i) = Asc(Mid(sMessage, i * 4 + 1, 1)) * mask(1) + Asc(Mid(sMessage, i * 4 + 2, 1)) * mask(2) + Asc(Mid(sMessage, i * 4 + 3, 1)) * mask(3) + Asc(Mid(sMessage, i * 4 + 4, 1))
-
Next
-
-
For i = 16 To 63
-
s0 = largeXor(largeXor(rightRotate(words(i - 15), 7, 32), rightRotate(words(i - 15), 18, 32), 32), Int(words(i - 15) / 8), 32)
-
s1 = largeXor(largeXor(rightRotate(words(i - 2), 17, 32), rightRotate(words(i - 2), 19, 32), 32), Int(words(i - 2) / 1024), 32)
-
words(i) = Mod32Bit(words(i - 16) + s0 + words(i - 7) + s1)
-
Next
-
-
For i = 0 To 7
-
temp(i) = hashValues(i)
-
Next
-
-
For i = 0 To 63
-
s0 = largeXor(largeXor(rightRotate(temp(0), 2, 32), rightRotate(temp(0), 13, 32), 32), rightRotate(temp(0), 22, 32), 32)
-
maj = largeXor(largeXor(largeAnd(temp(0), temp(1), 32), largeAnd(temp(0), temp(2), 32), 32), largeAnd(temp(1), temp(2), 32), 32)
-
t2 = Mod32Bit(s0 + maj)
-
s1 = largeXor(largeXor(rightRotate(temp(4), 6, 32), rightRotate(temp(4), 11, 32), 32), rightRotate(temp(4), 25, 32), 32)
-
ch = largeXor(largeAnd(temp(4), temp(5), 32), largeAnd(largeNot(temp(4), 32), temp(6), 32), 32)
-
t1 = Mod32Bit(temp(7) + s1 + ch + fraccubeprimes(i) + words(i))
-
-
temp(7) = temp(6)
-
temp(6) = temp(5)
-
temp(5) = temp(4)
-
temp(4) = Mod32Bit(temp(3) + t1)
-
temp(3) = temp(2)
-
temp(2) = temp(1)
-
temp(1) = temp(0)
-
temp(0) = Mod32Bit(t1 + t2)
-
Next
-
-
For i = 0 To 7
-
hashValues(i) = Mod32Bit(hashValues(i) + temp(i))
-
Next
-
-
If (index512 + 1) * 64 >= Len(sMessage) Then done512 = True
-
index512 = index512 + 1
-
Loop
-
-
For i = 0 To 31
-
result(i) = Int((hashValues(i \ 4) / mask(i Mod 4) - Int(hashValues(i \ 4) / mask(i Mod 4))) * 256)
-
Next
-
-
SHA = result
-
End Function
And there is one additional supporting function. - Function Mod32Bit(value)
-
Mod32Bit = Int((value / 4294967296# - Int(value / 4294967296#)) * 4294967296#)
-
End Function
Also, the SHA2 algorithm I posted is a 256-bit hash, not a 32-bit.
My head was thinking 32 Bytes (256 Bits), but my fingers typed 32 Bits, dangerous mistake! (LOL). Thanks for setting me straight.
Are we off topic? It's all in line with passwords isn't it? lol
If the opinion of the OP counts at all, I don't think it's off-topic! I've been following the discussion with real interest.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Al Dykes |
last post by:
I've just grabbed a PHP book and can deal with the syntax and now I
need to decide to learn specific packages and features.
Define "framework".
What are the major framework flavors ?
Under...
|
by: Jeremy Langworthy |
last post by:
Hi
I have two "totals" inputs whose values are dynamically calculated.
For obvious reasons I don't want users to be able to edit the
information in these. However, I do want this total passed to...
|
by: Jim Hubbard |
last post by:
It seems that Microsoft not only does not need the classic Visual Basic
developer army (the largest army of developers the world has ever seen), but
now they don't need ANY Windows developer at a...
|
by: John Oliver |
last post by:
I'd like the email produced by FormMail to show a specific From: address
rather than postmaster@server.host.name Googling isn't helping me...
not sure what to look for :-(
--
* John Oliver ...
|
by: John Harrison |
last post by:
An odd confession; an odd request; but here's the tale....
My company has a few PC systems which we have used for about 7 years
and not updated - we've "made do", and besides, "if it ain't...
|
by: Paul Sullivan |
last post by:
We are a state agency that views protected medical information via our
intranet. The screens even have privacy shields. Alarmingly, uses can
"Print" and "Save As" which destroys the protection of...
|
by: Tom Kaminski [MVP] |
last post by:
I can do this in ASP, but not sure how to handle in ASP.NET:
How To Use the ADODB.Stream Object to Send Binary Files to the Browser
through ASP
http://support.microsoft.com/?kbid=276488
Do I...
|
by: Randy |
last post by:
I hope somebody can make a hero out of me before tomorrow! Let's say I
have a web page with a couple of textboxes, checkboxes, radio buttons,
etc. User fills in some data, clicks submit, and off it...
|
by: Samuel R. Neff |
last post by:
When is it appropriate to use "volatile" keyword? The docs simply
state:
"
The volatile modifier is usually used for a field that is accessed by
multiple threads without using the lock...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |