For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2007 > SHA1 Vector Extraction Problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SHA1 Vector Extraction Problem
Idgarad

2007-08-06, 6:59 pm

I am working on a bit of a issue and I am hoping to find some
guidance.

Here is what I need to to:

I need to generate 2 SHA1 hashes (easy) based on an objects name and
it's DB id.

This is Easy so far and I have that down. I get 2 unique SHA1 hashes
stored.

Now depending on what I am doing I only need X number of bits out of
it. You see I am using the SHA1 hash as a unique pool of random bits I
am parsing. I need the first 8 for what type of effect I am going to
generate, the next 8 for how strong of an effect, and the next 8 for
how long the effects go for.

Now the question I have is how do I take a SHA1 hash and extract
certain segments of bits out of it via perl?

*** PART 2 ***
I am not a cryptographer by any measure but I am trying to do
something with unique content (can't get into details) where a user
has their own SHA1 hash and objects have their own.

What should I use to get a good pool of data by using the two together
(think.. ummm.. parents having a kid!)

Should I OR the bits, XOR the bits, or AND the bits? Lets assume that
more then 1 object can be used.


User
10110110...101010
Object 1
11101101...0000
Object 2
00100101....10010

etc..

I am leaning on XOR but I have to make sure that I have a good amount
of variance in the mix. I am hoping that using SHA1 against object
names and their DB id will prevent an all 0 and all 1 pool of bits.
And with XOR against concurrent SHA1 I am hoping not to end up with
all 0s and all 1s

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com