C 0000008 mmmv salting algorithm 02

From commentsarchive
Jump to: navigation, search

C 1..100

There are 4 registers, R0, R1, R2, R3. The R0 holds a number from set {1,2,3}. The set {1,2,3} elements are indices of registers other than the R0. That is to say, the R0 has the index of 0, the R1 has the index of 1, the R2 has the index of 2, the R3 has the index of 3. Only one of the registers R1, R2, R3 holds actual data and the rest of the 2 registers each hold a random number. The number in R0 determines, which of the registers R1, R2, R3 holds the actual data.


Modification 01

In stead of writing the index of the data holding register to the R0, the R0 may contain some number that is being used for calculating the index of the data storing register. One such function might be the reminder finding function.

    i_index= (contents(R0) mod 3) + 1 
    // The "+1" is to cope with the fact that a reminder can be 0 and 
    // the "whatever_whole_number mod 3" is never greater than 2.

The idea is that this way the contents of the R0 can have greater variation.

Modification 02

The nubmer of registers other than the R0 can be any number greater than 1, in which case the

    max(i_index) =  number_of_all_registers_including_the_R0 - 1