I use jsp and servlets in my web application. i need to store passwords in the database. I found that hashing will be the best way to do that.
I used this code to do it.
<%@page import="com.jSurvey.entity.*" %>
<%@page import="java.security.MessageDigest" %>
<%@page import="java.security.NoSuchAlgorithmExcepti...
Hi folks,
I'm trying to a somewhat sophisticated diff between individual rows in two CSV files. I need to ensure that a row from one file does not appear in the other file, but I am given no guarantee of the order of the rows in either file. As a starting point, I've been trying to compare the hashes of the string representations of the...
When calculating the load factor of a hashtable with an open-addressing array implementation I am using:
numberOfKeysInArray/sizeOfArray
however it occurred to me that since deleted entries must be marked as such (to distinguish them from empty spaces), it might make sense to include these in the number of keys.
My thinking is that ...
Hey everyone,
Further to my question here, I have another question regarding salts.
When someone says "use a random salt" to pre/append to a password, does this mean:
Creating a static a 1 time randomly generated string of characters, or
Creating a string of characters that changes at random every time a
password is created?
If th...
I ran across the question below in an old exam. My answers just feels a bit short and inadequate. Any extra ideas I can look into or reasons I have overlooked would be great. Thanx
Consider the MAD method compression function, mapping an object with hash code i to element [(3i + 7)mod9027]mod6000 of the 6000-element bucket array. Explai...
Hey, first, let me say, I'm not asking about things like md5(md5(..., there are already topics about it.
My question is this:
We allow our clients to store their passwords locally. Naturally, we don't want them stored in plan text, so we hmac them locally, before storing and/or sending. Now, this is fine, but if this is all we did, the...
Looking for good source code either in C or C++ or Python to understand how a hash function is implemented and also how a hash table is implemented using it.
Very good material on how hash fn and hash table implementation works.
Thanks in advance.
...
I have check out this Wikipedia page on it, but I still don't understand it. Can someone please help my dim-witted mind to understand the concepts of hashing, hashtable/hashmap, and hash functions? Some examples would really help.
...
This is an interview questions. I tried hard to come up with my desired solution, but no success yet!
An approach of O(n^2) time is pretty obvious with O(1) space, where n is the length of string/ total number of URLs.
An O(n) solution can be achieved which requires additional space. In the case of non-repeating first character in a st...
I'm having a problem with MessageDigest returning different hash values on different computers.
One computer is running 32-bit Java on Windows Vista and the other is running 64-bit Java on Mac OS. I'm not sure if it is because MessageDigest is machine dependent, or I need to explicitly specify a character encoding somewhere, or perhap...
In our project there are several places where we could've gotten away with hashing. For example, we store an encrypted reference between a license and the licensed object in the database along with the unencrypted reference. This is to ensure that the user can't change the entity they have licensed by mucking with the database.
The ma...
Hi
I have an array with size m = 11 and my hash function is Division method : h(k) = k mod m
I have an integer k = 10 and 10 mod 11 is -1 so where should I put this key in the array? I should put this key in the slot which its index is 10?
please help me thanks
EDITED : for getting my answer well for example I have integers like k = 10,...
I need to know the cost of succeeding with a Preimage attack ("In cryptography, a preimage attack on a cryptographic hash is an attempt to find a message that has a specific hash value.", Wikipedia).
The message I want to hash consists of six digits (the date of birth), then four random digits. This is a social security number.
Is the...
hash function is important in implementing hash table. I know that in java
Object has its hash code, which might be generated from weak hash function.
Following is one snippet that is "supplement hash function"
static int hash(Object x) {
int h = x.hashCode();
h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= ...
I have a class which holds a position in three floats. I have overridden Equals like so:
return Math.Abs(this.X - that.X) < TOLERANCE
&& Math.Abs(this.Y - that.Y) < TOLERANCE
&& Math.Abs(this.Z - that.Z) < TOLERANCE;
This is all very well, but now I need to write a GetHashCode implementation for these vertices, and I'm stuck. ...
Hi, I'm trying to upgrade from PHP 5.2.x to 5.3.2 on my server. Problem is, I relying on the broken implementation of PHP's ezmlm_hash() (the bug is outlined here: http://bugs.php.net/bug.php?id=47969).
My first thought was to rewrite the broken version of the native PHP function (which is written in C) myself in PHP and use that in my ...
I've been trying to hash the contents of some zip files from a remote source using PHP's md5_file function:
md5_file($url);
I'm having a problem with a couple of URLs; I'm getting the following error:
Warning: md5_file($url): failed to open stream: HTTP request failed!
I think it's because the zip files are quite large in those cas...
Currently looking into distributed memory cache solutions, such as Memcached and Microsoft's AppFabric caching. It seems to me that one of the difficult hurdles in implemented a distributed cache for an application is determining appropriate keys for the hash.
A naive approach is to hard code hash keys in your application so that all i...
Will the following function correctly hash my provided string? Or am I missing something fundamentally important?
Private Function HashString(ByVal value As String, ByVal salt As String) As String
Dim dataBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(value + salt)
Dim hash As New System.Security.Cryptography.SHA512Manage...
I have a bunch of images to download, after their downloaded I'd like to check them against one "special" image to see if there exactly the same as this image. To do this I could just compare the arrays directly item by item or I could compute a hash and compare this.
I think in this case directly comparing will be quicker, as we only d...