Y
Y
yoyaye2016-07-08 13:42:45
Programming
yoyaye, 2016-07-08 13:42:45

Need a hash-like function, up to 32 bits, with the ability to set a primary number?

Looking for 2 features. The meaning of the task is that you need to have 2 functions:
1. To create a number, you need the function f([ticket number],[first number]) = [first number][number sequence],
i.e. the result should start with the number that we specified.
for example, there is a series of tickets A, The ticket number will be f(A90414, 0) = the result of the function should be 0ADEA0.
2. For verification, if we take f(0ADEA0), we should get A90414.
0ADEA0 - closed inside a protected area that must be erased with a coin (for the lottery).
Krypkostability is not needed, collisions are possible, the dimension is from 32 to 128 bits.
examples:
A(A34243, 0) = 0a0Fd0 -> check B(0a0Fd0) = A34243;
A(C34303, A) = Aeecd0 -> check B(Aeecd0) = C34303;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2016-07-08
@yoyaye

Alternatively, use RSA. Cryptographic resistance on small numbers is not provided, but it is not needed according to the condition of the problem.

A
Alexey, 2016-07-08
@alsopub

2) Not exactly, if you allow collisions, then the function does not have an inverse transformation and you cannot get A90414 from 0ADEA0, you can only get 0ADEA0 from A90414.
The hash is 32 bits - CRC32 might work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question