Jump to content

Javascript Key Generator for Collision Testing

Hi, I'm looking to create a collision tester. Will Produce character strings from integers such as:

1 = A26 = Z27 = AA52 = ZA53 = AB

from this array:

var char = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; 

to put the combinations into a new array.

I'm just not sure how to build a decoder or if this is even the easiest or best way.

 

Thanks

Looking for a Programming Project take a look here!

http://linustechtips.com/main/topic/407332-looking-for-a-project-idea-start-here/

Link to post
Share on other sites

Collision testing?What?

 

Use cast to get the ascii value of a character :

char a = 'a';int n = (int)a;

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

 

Collision testing?What?

 

Use cast to get the ascii value of a character :

char a = 'a';int n = (int)a;

Collision Testing as in testing hash functions. Context would be nice, I have no idea what you're getting at.

Looking for a Programming Project take a look here!

http://linustechtips.com/main/topic/407332-looking-for-a-project-idea-start-here/

Link to post
Share on other sites

Collision Testing as in testing hash functions. Context would be nice, I have no idea what you're getting at.

I'm pretty sure those things aren't related in any way. You're probably using the wrong word.

 

Can you explain what you want to do?

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

if you just want to generate a sort of base-N increasing number using arbitrary symbols, then this could do it

var char = [your alphabet];function f(x){     var n = char.length;     var result = '';     do     {          result += char[x % n];          x = Math.floor(x / n);     }     while(x > 0);     return result;}

I'm pretty sure those things aren't related in any way.

given a hash function f, you have a collision when f(x) = f(y) and x != y

good hash functions have few collisions and with very different inputs

Link to post
Share on other sites

if you just want to generate a sort of base-N increasing number using arbitrary symbols, then this could do it

var char = [your alphabet];function f(x){     var n = char.length;     var result = '';     do     {          result += char[x % n];          x = Math.floor(x / n);     }     while(x > 0);     return result;}

given a hash function f, you have a collision when f(x) = f(y) and x != y

good hash functions have few collisions and with very different inputs

Aaaah!

That kind of collision.

I'm an idiot,sorry.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

if you just want to generate a sort of base-N increasing number using arbitrary symbols, then this could do it

var char = [your alphabet];function f(x){     var n = char.length;     var result = '';     do     {          result += char[x % n];          x = Math.floor(x / n);     }     while(x > 0);     return result;}

given a hash function f, you have a collision when f(x) = f(y) and x != y

good hash functions have few collisions and with very different inputs

Thanks, I'll just need to modify the function for the combinations. Example: AB, AFZ, GHSD.etc

Looking for a Programming Project take a look here!

http://linustechtips.com/main/topic/407332-looking-for-a-project-idea-start-here/

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×