hashing

How can I get an MD5 hash in ColdFusion?

I'm trying to get an MD5 hash of a value in ColdFusion. I tried this code using the Encrypt function1: <cfscript> val = 1117; md5 = Encrypt(val, 0, "MD5", "Hex"); </cfscript> But I get an error: The MD5 algorithm is not supported by the Security Provider you have chosen. How can I choose a different security provider? 1 Yes, ...

How are these 2 lines of code different?

Can someone tell me in really slow terms the difference between these 2 lines of PHP? $hassh = base64_encode(sha1($word)); $hassh = hash(’sha1′, $word); ...

Best practices around generating OAuth tokens?

I realize that the OAuth spec doesn't specify anything about the origin of the ConsumerKey, ConsumerSecret, AccessToken, RequestToken, TokenSecret, or Verifier code, but I'm curious if there are any best practices for creating significantly secure tokens (especially Token/Secret combinations). As I see it, there are a few approaches to ...

Intentional Hashing Collisions

I'm trying to write some code that will do "fuzzy hashing". That is: I want several inputs to hash to the same output so that I can do searches etc quickly and easily. If A hashes to 1 and C hashes to 1, it will be trivial for me to find out that A is equivalent to C. Designing such a hash function seems hard, so I was wondering if any...

Is SHA512Managed considered the best one-way hash available in .NET 3.5 for security?

Three SHA512Managed related questions: Is SHA512Managed considered the best one-way hash available in .NET 3.5 for security? What Salt size should be used with SHA512Managed? The application is for strong passwords with at least 8 characters. Is 512 overkill compared to 256 for small strings? ...

Needed an efficient way for search for the following specfic requirement

I have to search a given file name (let say Keyword) in a directory containing files. If there were only few keywords to be searched, I could have used regular search (like creating an array of file names residing in the specified directory and then search each file name with the given keyword). Since I need to search very large number...

How much more likely are hash collisions if I hash a bunch of hashes?

Say I'm using a hash to identify files, so I don't need it to be secure, I just need to minimize collisions. I was thinking that I could speed the hash up by running four hashes in parallel using SIMD and then hashing the final result. If the hash is designed to take a 512-bit block, I just step through the file taking 4x512 bit blocks a...

There any way to differentiate a md5 of a sha-1 ?

Hi, i want to know if exist a way to differentiate a md5 hashcode of a sha-1 hashcode? For example: d41d8cd98f00b204e9800998ecf8427e da39a3ee5e6b4b0d3255bfef95601890afd80709 How i could to know which are encrypted in md5 and wich not? Is it possible? ...

hmac-sha1 in ruby differs from C# HMACSHA1

I am trying to test the API from ankoder.com and have problem on the digest calculation for the authentication token . The sample is ruby while I am trying to call from C#. When I compare the digest result between in HMAC-SHA1, I got issues with the passkey result. To make it easy to test here is the code: require 'hmac-sha1' require ...

How should I store a user's LDAP password in a cookie?

So I have this black box authentication method, handed down to me from the accounts people, which basically amounts to ldap_bind($connection, $username, $password). But of course, I want my users to be able to log in for, say, 30 days at a time. The naive but insecure way to handle this is to store the username and password in plaintext...

Boost Multi-Index with hashed_unique_index produces compiler error

Hello, I learned in THIS THREAD how a hashed_unique<> index can be used with a composite_key using an int and a std::vector<int>. But unfortunately the following code produces quite an error message: 1> boost/multi_index/hashed_index.hpp(439) : error C2784: 'size_t .. composite_key_hash<...>::operator ()(const boost::tuples::tuple<......

What is the fastest hash algorithm to check if two files are equal?

What is the fastest way to create a hash function which will be used to check if two files are equal? Security is not very important. Edit: I am sending a file over a network connection, and will be sure that the file on both sides are equal ...

Which hash to use for file uniqueness in Java

I'm trying to keep track of a set of files, which may have the same name and metadata. I'd like to use a hash to differentiate and use it as a unique ID, but I'm not sure which one to use? The files are relatively small (in the 100 kb range) and I'd like to be able to hash that in less than 10 seconds. Which hash (that comes built in ...

How to convert an 18 Character String into a Unique ID ?

Hi, I have an 18 Character String that I need to convert into a unique long (in Java). A sample String would be: AAA2aNAAAAAAADnAAA My String is actually an Oracle ROWID, so it can be broken down if needs be, see: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#CNCPT713 The long number generated, (1) Mus...

Hash tables optimization

Hi In several hash table implementations I've seen the usage of heuristics like "transpose" or "move to front" for items in a bucket. What are the advantages of using such heuristics? I could't figure it out myself. Which other optimizations can be done at the hash table / bucket level, why, and under which circumstances? Optimizing...

Secure Password Hashing

I need to store a hash of a single password in a .Net WinForms application. What's the most secure way to do this? In particular: Salt, HMAC, or both? How much salt? How many iterations? What encoding? (The password is plain ASCII) I assume that the algorithm should be either SHA512 or HMACSHA512. ...

Hashing Multiple Files

Problem Specification: Given a directory, I want to iterate through the directory and its non-hidden sub-directories,  and add a whirlpool hash into the non-hidden file's names. If the script is re-run it would would replace an old hash with a new one. <filename>.<extension>   ==>  <filename>.<a-whirlpool-hash>.<e...

Probability of SHA1 collisions

Given a set of 100 different strings of equal length, how can you quantify the probability that a SHA1 digest collision for the strings is unlikely... ? ...

Calculating SHA1 of a file

I'm trying to calculate the SHA-1 value of a file. I've fabricated this script: def hashfile(filepath): sha1 = hashlib.sha1() f = open(filepath, 'rb') try: sha1.update(f.read()) finally: f.close() return sha1.hexdigest() For a specific file I get this hash value: 8c3e109ff260f7b11087974ef7bcdbdc69...

Creating a "true" HashMap implementation with Object Equality in ActionScript 3

I've been spending some of my spare time working a set of collections for ActionScript 3 but I've hit a pretty serious roadblock thanks for the way ActionScript 3 handles equality checks inside Dictionary Objects. When you compare a key in a dictionary, ActionScript uses the === operator to perform the comparison, this has a bit of a na...