Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:48:05+00:00 2026-06-17T21:48:05+00:00

Code: import itertools import string import hashlib def hash_f(x): h = hashlib.md5(x) return int(h.hexdigest(),base=16)

  • 0

Code:

import itertools
import string
import hashlib

def hash_f(x):
    h = hashlib.md5(x)
    return int(h.hexdigest(),base=16)


value = raw_input("Enter a value: ")
oneChar = [map(''.join, itertools.product(string.ascii_lowercase, repeat=1))]
twoChar = [map(''.join, itertools.product(string.ascii_lowercase, repeat=2))]
threeChar = [map(''.join, itertools.product(string.ascii_lowercase, repeat=3))]
possibleValues = oneChar + twoChar + threeChar

hashed_list = [int(hashlib.md5(x).hexdigest(), base=16) for x in possibleValues]

for x in hashed_list:
    if hash_f(value) == x:
        print "MATCH"

The error I get when I try to run this code is the following:

Traceback (most recent call last):
    File "hash.py", line 18, in <module>
        hashed_list = [int(hashlib.md5(x).hexdigest(), base=16) for x in possibleValues]
TypeError: must be string or buffer, not list

Going through this in my head, the only problem that I can see is an error with hashlib, but shouldn’t that be negated due to the fact that I’m cycling through each individual value in possibleValues?

All help greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:48:06+00:00Added an answer on June 17, 2026 at 9:48 pm

    The output of map is a list already, did you mean to use:

    oneChar = map(''.join, itertools.product(string.ascii_lowercase, repeat=1))
    twoChar = map(''.join, itertools.product(string.ascii_lowercase, repeat=2))
    threeChar = map(''.join, itertools.product(string.ascii_lowercase, repeat=3))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code: from itertools import permutations import hashlib def hash_f(x):
code: import urllib,urllib2 url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php' print urllib2.urlopen(url).read() print urllib2.urlopen(url,urllib.urlencode({'nothing':12345})).read() the question I encounter
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
I have this code: import re def doReplace(toReplace): i = 1 def chapterReplacer(_): result
import itertools print itertools#ok the code is ok but i can't find the itertools
Suppose I have this Python code: from itertools import count, tee original = count()
Possible Duplicate: Using itertools.product and want to seed a value I have this code,
Demo code: import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; public class Main { public static void main(String[]
import itertools def _yield_sample(): it = iter(itertools.combinations('ABCD', 2)) it2 = iter(itertools.combinations('EFGH', 3)) itc =
I have the following code: from crypt import crypt from itertools import product from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.