Note that there are some explanatory texts on larger screens.

plurals
  1. POIssues with Python hashlib.sha256 (2.4.3)
    primarykey
    data
    text
    <p>So I have some code:</p> <pre><code>signature = hmac.new( key=AWS_SECRET_ACCESS_KEY, msg=string_to_sign, digestmod=hashlib.sha256).digest() </code></pre> <p>That runs perfectly on my own computer (has python 2.6.1). However, when I run this code on my server (Python 2.4.3) I get the following:</p> <pre><code> /home/MYUSERNAME/public_html/Foo.com/cgi-bin/foo.py 66 key=AWS_SECRET_ACCESS_KEY, 67 msg=string_to_sign, 68 digestmod=hashlib.sha1).digest() 69 70 # Base64 encode the signature digestmod = &lt;built-in function openssl_sha256&gt;, hashlib = &lt;module 'hashlib' from '/usr/lib/python2.4/site-...shlib-20081119-py2.4-linux-i686.egg/hashlib.pyc'&gt;, hashlib.sha1 = &lt;built-in function openssl_sha1&gt;, ).digest undefined /usr/lib/python2.4/hmac.py in new(key='xR6MsC/+Vc2xkd0YYbER0meR/IkWEU', msg='GET\necs.amazonaws.com\n/onca/xml\nAWSAccessKeyId=A...CommerceService&amp;Timestamp=2010-07-03T18%3A56%3A48', digestmod=&lt;built-in function openssl_sha1&gt;) 103 You can now feed arbitrary strings into the object using its update() 104 method, and can ask for the hash value at any time by calling its digest() 105 method. 106 """ 107 return HMAC(key, msg, digestmod) global HMAC = &lt;class hmac.HMAC&gt;, key = 'xR6MsC/+Vc2xkd0YYbER0meR/IkWEU', msg = 'GET\necs.amazonaws.com\n/onca/xml\nAWSAccessKeyId=A...CommerceService&amp;Timestamp=2010-07-03T18%3A56%3A48', digestmod = &lt;built-in function openssl_sha1&gt; /usr/lib/python2.4/hmac.py in __init__(self=&lt;hmac.HMAC instance&gt;, key='xR6MsC/+Vc2xkd0YYbER0meR/IkWEU', msg='GET\necs.amazonaws.com\n/onca/xml\nAWSAccessKeyId=A...CommerceService&amp;Timestamp=2010-07-03T18%3A56%3A48', digestmod=&lt;built-in function openssl_sha1&gt;) 40 41 self.digestmod = digestmod 42 self.outer = digestmod.new() 43 self.inner = digestmod.new() 44 self.digest_size = digestmod.digest_size self = &lt;hmac.HMAC instance&gt;, self.outer undefined, digestmod = &lt;built-in function openssl_sha1&gt;, digestmod.new undefined AttributeError: 'builtin_function_or_method' object has no attribute 'new' args = ("'builtin_function_or_method' object has no attribute 'new'",) </code></pre> <p>I know the obvious response is to just update Python on my server, but my host has to do that and I don;t know how long it'll take. I'm just curious if this is a common/known issue on 2.4.3 or if something else is going on.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload