Exemple #1
0
def digest_integer( m ):
  """Convert an integer into a string of bytes, compute
     its SHA-1 hash, and convert the result to an integer."""
  #
  # I don't expect this function to be used much. I wrote
  # it in order to be able to duplicate the examples
  # in ECDSAVS.
  #
  #import sha
  from hashlib import sha1
  return string_to_int( bytearray(sha1( compat26Str(int_to_string( m )) ).digest()))
Exemple #2
0
def digest_integer(m):
    """Convert an integer into a string of bytes, compute
     its SHA-1 hash, and convert the result to an integer."""
    #
    # I don't expect this function to be used much. I wrote
    # it in order to be able to duplicate the examples
    # in ECDSAVS.
    #
    #import sha
    from hashlib import sha1
    return string_to_int(
        bytearray(sha1(compat26Str(int_to_string(m))).digest()))
Exemple #3
0
 def SHA256(b):
     "Return a 32-byte bytearray which is the SHA256 of input bytearray."
     return bytearray(hashlib.sha256(compat26Str(b)).digest())
Exemple #4
0
 def SHA256(b):
     "Return a 32-byte bytearray which is the SHA256 of input bytearray."
     return bytearray(hashlib.sha256(compat26Str(b)).digest())