Skip to content

Hacking a linear congruent number generator. Implementation of the algorithm for calculating the next number by the four previous ones. Count the parameter m no more than 65535

Notifications You must be signed in to change notification settings

letby3/Congruent-number-generator-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

#Сongruent-number-generator-hack

2.3 Взлом линейного конгруэнтного генератора чисел. Реализация алгоритма вычисления последующего числа по четырем предыдущим. Считать параметр m не более 65535. Например, есть 4 числа : 157; 5054; 25789; 13214 Следующим за этими числами будет число 16605

Решение:

Hardware: i5-10300H

OS: Ubuntu 18.04

Compiler: CMake 3.8

Файлы: "LinearCongruentMethod.cpp", "LinearCongruentMethod.h"

image

Основываясь на выражении (1), мы ищем таким образом кратное параметру m. Далее перебором всех множителей в диапазоне от MAX(x0, x1, x2, x3) до 65535 мы получаем значения параметров a и c. Если у нас получается u равное 0 (выражение (2)), то m любое значение от MAX(x0, x1, x2, x3) до 65535. Возможных решение большое множество. Выбираем с наименьшим значением m = MAX(x0, x1, x2, x3) + 1.

Литература:

  1. https://security.stackexchange.com/questions/4268/cracking-a-linear-congruential-generator

About

Hacking a linear congruent number generator. Implementation of the algorithm for calculating the next number by the four previous ones. Count the parameter m no more than 65535

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages