Questions tagged [hashlib]

Hashlib is a Python module that implements a common interface to many different secure hash and message digest algorithms.

427 questions
0
votes
1 answer

Python - hashlib won't "pick up" the files in a routine

I'm using the hashlib func in a script I'm writing, and I can't get it to take the files I'm pointing it towards - its only returning the hash of a 0kb file d41d8cd98f00b204e9800998ecf8427e. I'm calling it like so: fHash=md5Checksum(f) where f is a…
Jay Gattuso
  • 3,890
  • 12
  • 37
  • 51
0
votes
2 answers

Attribute Errors - Python

I have the following code snippets thetype = raw_input("Please enter hash type. md5 or sha1") hash_type = hashlib.thetype(word).hexdigest() This returns the error "AttributeError: 'module' object has no attribute 'thetype' " I kind of understand…
-1
votes
2 answers

My code is not working. Althought GUI is fine, the functions of this application isn't working

Here's My Code: from tkinter import * import hashlib root=Tk() root.title('iHash…
-1
votes
1 answer

HMAC-SHA256 in Python is producing different output to Nodejs

I have a python script which uses the HMAC-hashlib.sha256 algorithm to generate a signature to authenticate over API. # ZenEmu import base64 import hashlib import hmac import json from datetime import datetime import requests data = json.dumps( …
damian-sketch
  • 151
  • 1
  • 14
-1
votes
2 answers

Hash sha512 contents of a file in python

So im writing a smiple File Integrity Monitor. And im trying to hash the contents of a file and store it as a baseline. This is my code: from base64 import encode import hashlib h =hashlib.sha512() with open ("baseline.txt", 'r') as f: …
-1
votes
2 answers

When I am trying to use cryptography PBKDF2 hash in python but when I enter a wrong password it throws error

backend = default_backend() salt = b'2444' kdf = PBKDF2HMAC( algorithm=hashes.SHA256(), length=32, salt=salt, iterations=100000, backend=backend ) This is the kdf setup. def getMasterPassword(): …
-1
votes
1 answer

Hashed identical strings aren't the same when hashed twice

I have a login program that hashes a string and stores it in a file to create a new account. When I need to log in, the login detail strings get hashed, and the program checks if the hashed strings have a match in the file. The program works without…
-1
votes
1 answer

missing one required positional argument

I was working on a blockchain project. Nothing wrong seemed to come of it, until I added the mining function. Then it spit out two errors that it was missing positional argument. the first was the main function on line 45, and the second one was…
-1
votes
1 answer

Python Password Hashing with hashlib

I'm trying to hash a password for a login system I am creating. I am using the hashlib import and using the blake2b hash algorithm. I can't seem to figure out how to hash a variable such as passwordEntry. All the hashlib examples are just of blake2b…
-1
votes
1 answer

How to convert php md5(sha1(time())) in python3?

am new in python.. usually I do this in PHP md5(sha1(time())) and it convert something like: 017df9435b048f86ac28a274543ac46df5e20e0ecff32123a58287 Now how to do it in python3? I've tried importing hashlib print(hashlib.md5(int(round(time.time() *…
-1
votes
1 answer

Hashing an exe file

How can I hash an executable file in PYTHON? I've downloaded an exe file and I have its hash. I want to hash by myself and compare 2 hashes for more certainty.
harez
  • 1
  • 3
-1
votes
2 answers

Hash having slashes added when appending to a list (Python)

When using os.urandom(64) it generates a string with 64 random characters, this works as intended but oddly when turning it, alongside other data into a list (I need to do this to writerow into a csv file) it turns the slashes into double…
-1
votes
1 answer

Issue in RECURRENT NEURAL NETWORK

Please let us know anything wrong in below code, not getting desire result - from numpy import sqrt from numpy import asarray from pandas import read_csv from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense from…
Ashish Jindal
  • 35
  • 1
  • 9
-1
votes
2 answers

How to hash an already hashed value for a given range?

I'm trying to design a One-Time-Password algorithm. I want to get a string input from the user and hash it repeatedly for a 100 times, then store each into an array. I'm stuck on the part that requires repeatedly hashing the string. I've tried the…
-1
votes
1 answer

Python 3: Error - Hashlib has no attribute 'SHA256'

import hashlib h = hashlib.SHA256(string) Error raised: AttributeError: module 'hashlib' has no attribute 'SHA256' I found this similar to my question: But my output for "import hashlib" and print(dir(hashlib)) is: ['__all__',…
user1045890
  • 379
  • 1
  • 5
  • 11