Hashes, sha256 and cryptoPy
#1
I'm trying to compute a sha256 hash, but as you may know hashlib isn't available with the current python version in XBMC.

However, I see that cryptoPy is an addon module, but I can't find any documentation as to what it supports and how to use it. I've been round the houses without luck, and it's given me an actual headache!!

Anyone here know anything?
Reply
#2
I had the same problem, I ended up pulling just the SHA-256 function out of I *think* cryptoPy:

http://xbmc-ampache-plugin.googlecode.co...-0.1.2.rar
Reply
#3
Thanks. I had a look through and it looks good, but I'm worried about the cross-platform aspect. Does your plugin only run on windows?
Reply
#4
hippojay Wrote:I'm trying to compute a sha256 hash, but as you may know hashlib isn't available with the current python version in XBMC.

However, I see that cryptoPy is an addon module, but I can't find any documentation as to what it supports and how to use it. I've been round the houses without luck, and it's given me an actual headache!!

Anyone here know anything?

this? -> https://github.com/amet/script.xbmc.subt.../sha256.py
Reply
#5
hippojay Wrote:Thanks. I had a look through and it looks good, but I'm worried about the cross-platform aspect. Does your plugin only run on windows?

No, it's completely cross platform. All of the platform-specific stuff has been eliminated. If there are remnants lying around, it's because I'm lazy and I haven't cleaned it up.
Reply
#6
amet Wrote:this? -> https://github.com/amet/script.xbmc.subt.../sha256.py

That's the one I'm using.
Reply
#7
mbetter Wrote:No, it's completely cross platform. All of the platform-specific stuff has been eliminated. If there are remnants lying around, it's because I'm lazy and I haven't cleaned it up.

Ahh. I only had a quick look this morning (on my phone) and saw the platform specific binary code and thought this was how it worked.

Looks like this is the way to do it, I'll put it in my plugin and see how I go. Thanks mbetter and amet.
Reply
#8
Woops, what I actually needed was tha HMAC from a sha256. So whilst sha256.py works, it doesn't work when creating a new hmac :-(

so doing this:
dig=hmac.new(privateKey, msg, digestmod=sha256).hexdigest()

gives me this:
AttributeError: 'module' object has no attribute 'digest_size'

Back to the drawingboard

EDIT: forget that - I just fallen in love with python. Took a copy of hmac.py, hardcoded a few things for sha256 and it works!! Not the best way to do it, but a definate work around until XBMC moves to something a little more current.
Reply

Logout Mark Read Team Forum Stats Members Help
Hashes, sha256 and cryptoPy0