I am looking for someone who uses his/her high maths expertise to create an algorithm to deliver pseudo-random TAN codes. The algorithm starts off with a seed and is able to generate any n-th code. Repeatedly retrieving a code for the same position returns the same value. Repetition of the same value at different position: not before 10^12 values or better.
It is able to generate the next code based on the last one or on the position/index provided as input. The code itself is a string consisting of a set of chars.
The algorithm is able to check a given code if it is a valid code of the sequence created by seed.
The algorithm is able to save and restore its state (serializable). It does not precalculate a list of keys. Repetition of codes is ok,
Some terms:
- Position: whatever needed to indicate the n-th code in the sequence. Integer, structure, whatever is needed.
- Alphabet, a set of one or many of those:
- Lower: all lower case chars a-z
- Upper, all upper case char A-Z
- Digits, 0-9
- Special, non-alfanum chars
- Safe, eliminates dangerous chars like ilIO0S5
I could imagine something like this in pseudo-code:
Class TANgen.
Constructor (seed, alphabet, codelength) // this initializes the algorithm to be able to start. It shuld assume that we will retrieve one code after another, so the class memorizes how many codes have already been generated.
string function get ()
string function get (position)
// get the next code or the code at position.
string function get_next (position)
string function get_next (code)
// both functions get the next code, following the one given either by a position or a code
string[] function get (position, count)
string[] function get (code, count)
// get count codes starting with the one given by either a position or a code
position function validate (code)
// checks the code and returns its position or null if not valid
boolean function validate (code, position)
// wrapper for validate() != null
position function validate (code, position, windowsize)
// returns the position of a code if found at position, where position is the middle position of a sliding window. So like code in (code[position-windowsize],…,code[position-1],code[position],code[position+1],…,code[position+windowsize])
function save()
function load()
Maybe someone has already done that or knows where I can start off.
Any help or pointers to source is highly appreciated.
Thank you.
Aucun commentaire:
Enregistrer un commentaire