jsleuth
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2012
09:17 AM
PBKDF2
I am attempting to implement PBKDF2 (Password-Based Key Derivation Function 2) in britescript. I managed to implement a dynamic hashing function using roHMAC and roByteArray. The two steps I'm having trouble with are converting an ascii string to binary (and back) and also a bit-wise XOR function.
Any thoughts?
Any thoughts?
2 REPLIES 2

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2012
11:27 AM
Re: PBKDF2
roByteArray has both FromAsciiString and ToAsciiString methods.
For XOR, try this:
For XOR, try this:
Function Xor(a As Integer, b As Integer) As Integer
If a = 0 Then Return b
If b = 0 Then Return a
Return ((a And Not b) Or (Not a And b))
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
jsleuth
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2012
02:01 PM
Re: PBKDF2
Excellent, thanks, that's what I went with.
I can't tell if there's a subtle bug in britescript or not but after adding the extra bytes to the end of the salt the ascii-based SHA256 hashing was producing incorrect values. When I switched to hexString-based hashing everything started to work though.
The other downside is that the recommended 4096 loops of hashing takes multiple minutes to complete on the roku box. I don't think it'll actually be usable in this case. Bummer. 😞
I can't tell if there's a subtle bug in britescript or not but after adding the extra bytes to the end of the salt the ascii-based SHA256 hashing was producing incorrect values. When I switched to hexString-based hashing everything started to work though.
The other downside is that the recommended 4096 loops of hashing takes multiple minutes to complete on the roku box. I don't think it'll actually be usable in this case. Bummer. 😞