java - Non-cryptographic encryption algorithm -
similar non-cryptographic one-way hash (eg, building hash tables) find myself needing not-necessarily-cryptographic-strength two-way, symmetric-key "encryption" function. plan use in design of data structure.
desired properties are:
- fast
- not terribly difficult implement (in java if matters)
- need not totally reversible; if given plaintext size if generates small, expected-constant number of possibilities, ok.
- deals small data sizes (eg, "encrypting" single 64-bit long)
- good bit dispersion characteristics (ie, xor-with-random-number suboptimal because sequential numbers end bits shared). relation number of bits set in input , output should ~random.
does such algorithm exist, or can in java standard library shoehorned role?
one option take implementable cipher http://en.wikipedia.org/wiki/blowfish_%28cipher%29 , run reduced number of rounds - e.g. 16 3. 3 - because 3 rounds used in http://en.wikipedia.org/wiki/feistel_cipher#theoretical_work.
another use h(x) = * x + b mod p (or mod 2^n if odd). p prime example of http://en.wikipedia.org/wiki/universal_hashing if x limited (0, p-1). x in fact number of words long, process each word individually - not secure @ all, security not aim. whether random enough or not depends on data , trying achieve hashing it.
Comments
Post a Comment