In php is there a way to give a unique hash from a string, but that the hash was made up from numbers only?
example:
return md5(234); // returns 098f6bcd4621d373cade4e832627b4f6
but I need
return numhash(234); // returns 00978902923102372190
(20 numbers only)
the problem here is that I want the hashing to be short.
edit:
OK let ...
Hi,
I think the title is self-explanatory. Many times I have small typos and I get unexpected results when trying to access undefined hash keys. I know I can add some defined check before each time I access a hash key, but I wonder if there's any cleaner way to warn against such cases....
Best,
Dave
...
I'm at a loss here. I have this class I've created that takes arguments in object form:
new Widget('id_of_element', { option1: 'foo', option2: 'bar' });
However, the second argument isn't being seen as a hash, but as an object, so I can't apply default settings to if one is not set:
initialize: function (element, options) {
this....
I don't want to reverse it. I just want to be sure what hash algorithm was used on these strings (I'm not sure if it's md5):
d27918bcc2a8562dc4549c2c00111e66
889f071e04755db26579a19f4303654e
47a21a13ee822c1450155bd0033b0f1d
Is there a way to do it?
One of the source for the strings above is certainly: '9915757678'
...
Hello,
This page says that "for the Hash access method, you only need a single lock object".
http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/lock_max.html
Does this mean that all the processes/threads that access the database will try to lock the same lock object? Doesn't it cause a very high lock co...
If I have a users 6 digit PIN (or n char string) and I wish to verify say 3 digits chosen at random from the PIN (or x chars) as part of a 'login' procedure, how would I store the PIN in a database or some encrypted/hashed version of the PIN in such a way that I could verify the users identity?
Thoughts:
Store the PIN in a reversible
...
Hey there.
I have a Java application that needs to communicate with my server application (java application proxy forward by apache).
In my web site, I am using wordpress, so in order to use the same users in my site and in my application, I decided to use the wordpress users table in the db.
I need to be able to create a new user fr...
In my application I need to compute a hash of a given .NET assembly and of a given type.
Assemblies and types to hash are loaded dynamically in this scenario.
Object's built-in method GetHashCode returns different value each time an application is started.
How to compute a deterministic hash function of an assembly or a type?
Any a...
Once I've generated a salt and hashed the password (using bcrypt, etc) would it be best to store the results as a string or as a byte array in the database? Are there any benefits either way? Or is it a more subjective decision?
...
Hi, I want to print a key from a given hash key
but can't find simple solution
myhash = Hash.new
myhash["a"] = "bar"
# not working
myhash.fetch("a"){|k| puts k }
# working, but ugly
if myhash.has_key("a")?
puts "a"
end
Any other way?
tnx
...
Given a hash in Perl (any hash), how can I extract the values from that hash, in the order which they were added and put them in an array?
Example:
my %given = ( foo => '10', bar => '20', baz => '15' );
I want to get the following result:
my @givenValues = (10, 20, 15);
...
Is it possible conditional sort in hash
my hash like {1=>"10",2=>"20",3=>"30",4=>"40",5=>"50",6=>"60",7=>"70",8=>"80",9=>"90"}
wanted result is
{7=>"70",8=>"80",9=>"90",1=>"10",2=>"20",3=>"30",4=>"40",5=>"50",6=>"60"}
add condition in this code
operation_hour_hash.sort{|key,value| key[1]<=>value[1]}
...
If I use MD5, as an example, twice with some data, will it increase the probability of collision?
And what about SHA?
I am asking this because I thought of hashing a password in the client and then again in the server.
...
Hi
My application generates loads of images and in order to save memory, I write these files to the temporary directory and read them when needed. I write two versions of the same image to the tmp folder one the thumbnail version at lower resolution and the other is full size. To make the file names unpredictable, I add a string hash at...
The title says it all.
...
I have a bunch of posts which have category tags in them.
I am trying to find out how many times each category has been used.
I'm using rails with mongodb, BUT I don't think I need to be getting the occurrence of categories from the db, so the mongo part shouldn't matter.
This is what I have so far
@recent_posts = current_user.rec...
I have an issue dealing with a hash of objects. My hashes are player names, and the object has a property @name also.
I am trying to iterate over multiple players, and be able to use their methods and such with rather clean code. Here is how I create the hash:
puts "Who all is playing?"
gets.split.each do |p|
players[p] = Player.ne...
I have a list of n strings (names of people) that I want to store in a hash table or similar structure. I know the exact value of n, so I want to use that fact to have O(1) lookups, which would be rendered impossible if I had to use a linked list to store my hash nodes. My first reaction was to use the the djb hash, which essentially d...
Hello everybody!
I'm searching for a "bad" hash function:
I'd like to hash strings and put similar strings in one bucket.
Can you give me a hint where to start my research?
Some methods or algorithm names...
Thnaks in advance!
Sebastian
...
Hi,
this is my first question so please be gentle...
I am working on a software which I would like to protect using some kind of licensing scheme.
A basic scheme would be to generate some "unique" key for a user. The user sends this key and a registration code when he wants to register the software and receives an activation code.
Whe...