md5

MD5 hash differences between Python and other file hashers

I have been doing a bit of programming in Python (still a n00b at it) and came across something odd. I made a small program to find the MD5 hash of a filename passed to it on the command line. I used a function I found here on SO. When I ran it against a file, I got a hash "58a...113". But when I ran Microsoft's FCIV or the md5sum.py...

How can you generate the same MD5 Hashcode in C# and Java?

Hi, I have a function that generates a MD5 hash in C# like this: MD5 md5 = new MD5CryptoServiceProvider(); byte[] result = md5.ComputeHash(data); StringBuilder sb = new StringBuilder(); for (int i = 0; i < result.Length; i++) { sb.Append(result[i].ToString("X2")); } return sb.ToString(); In java my function looks like this: Mess...

Saving a MD5 hash of a text file into the same text file?

Today I read about MD5 hash and was wondering if this is possible. seems like a recursive problem... or is there a solution? ...

Cakephp - how to encrypt and then decrypt data that is being stored and retrieved from the database.

Err.... like the question says. How do I go about encrypting and then decrypting data that is being stored and retrieved from the database. By the way it's not just for storing a password which has been md5ed, I need to retrieve the data too. Thanks! ...

iPhone: fast hash function for storing web images (url) as files (hashed filenames)

What is a fast hash function available for the iPhone to hash web urls (images)? I'd like to store the cached web image as a file with a hash as the filename, because I suppose the raw web url could contain strange characters that could cause problems on the file system. The hash function doesn't need to be cryptographic, but it defi...

Is there any difference between md5 and sha1 in this situation?

It is known that 1. if ( md5(a) == md5(b) ) 2. then ( md5(a.z) == md5(b.z) ) 3. but ( md5(z.a) != md5(z.b) ) where the dots concatenate the strings. EDIT --- Here you can find a and b: http://www.mscs.dal.ca/~selinger/md5collision/ Check these links: hexpaste.com/qzNCBRYb/1 - this is a.md5(a)."kutykurutty" hexpaste....

convert password encryption from java to php

I'm trying to create a PHP version of an existing JSP program, however I'm stuck at the password encryption part. Could you please tell me how to convert this one? I know it tries to get the md5() but after that, I don't get it. I get lost in the Stringbuffer and for() parts. Can you help me out? public static String encryptPassword(...

Storing values of an array in one variable

Hello, I am trying to use md5 code to calculate checksums of file. Now the given function prints out the (previously calculated) checksum on screen, but I want to store it in a variable, to be able to compare it later on. I guess the main problem is that I want to store the content of an array in one variable. How can I manage that? ...

calculate and display file MD5 Hash in a label

How can the MD5 Hash of a file be calculated and displayed in a label? ...

BaseX XML database code

I'm a student of computer science and we have to use BaseX (a pure Java OSS XML database) in one of our courses. While browsing through the code I discovered the following piece of code: /** * Returns a md5 hash. * @param pw password string * @return hash */ public static String md5(final String pw) { try { ...

Tomcat Digest with Manager WebApp

I'm trying to get a digest password setup for the tomcat manager application. I've got <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" digest="MD5"/> in my tomcat server.xml changed the manager web application's web.xml to use digest and changed the realm name to TESTING: ...

MD5 in Object-C and C#

Hi, I have a method written in c# to get md5: public static string encryptPasswordWithMd5(string password) { MD5 md5Hasher = MD5.Create(); byte[] data = md5Hasher.ComputeHash(Encoding.Unicode.GetBytes(password)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.Length; i++) ...

Change a files md5 number using a batch file

I'm a really newbie, so sorry if the title isn't grammatically correct :p Anyway... Can I change a files md5 number using a batch file ...

How can I concatenate these values and perform an md5 calculation

I have some values: $data1 $data2 $data3 I want to concatenate these variables and then perform an md5 calculation how is it done?? ...

PHP: How to create the uppercase MD5 value of the ASCII equivalent of a word?

I have a secret word (example. dirtydawg) And using PHP I want to create the uppercase MD5 value of the ASCII equivalent of the secret word. How do I do this???? ...

Help creating md5 in php

I am trying to create an md5 value in php using the instruction given. I can't seem to get it right and would like you help understanding the instructions and the code. This is what the instructions say: The md5 is constructed by performing an MD5 calculation on a string built up by concatenating these fields. Specifically the MD5 has...

What's the big deal with brute force on hashes like MD5

I just spent some time reading http://stackoverflow.com/questions/2768248/is-md5-really-that-bad (I highly recommend!). In it, it talks about hash collisions. Maybe I'm missing something here, but can't you just encrypt your password using, say, MD5 and then, say, SHA-1 (or any other, doesn't matter.) Wouldn't this increase the processi...

How to calculate md5 checksum on directory with java or groovy ?

I am looking to use java or groovy to get the md5 checksum of a complete directory. I have to copy directories for source to target, checksum source and target, and after delete source directories. I find this script for files, but how to do the same thing with directories ? import java.security.MessageDigest def generateMD5(fin...

From string to hex MD5 hash and back

I have this pseudo-code in java: bytes[] hash = MD5.hash("example"); String hexString = toHexString(hash); //This returns something like a0394dbe93f bytes[] hexBytes = hexString.getBytes("UTF-8"); Now, hexBytes[] and hash[] are different. I know I'm doing something wrong since hash.length() is 16 and hexBytes.length() is 32. Maybe...

Is it okay to truncate a SHA256 hash to 128 bits?

MD5 and SHA-1 hashes have weaknesses against collision attacks. SHA256 does not but it outputs 256 bits. Can I safely take the first or last 128 bits and use that as the hash? I know it will be weaker (because it has less bits) but otherwise will it work? Basically I want to use this to uniquely identify files in a file system that migh...