-
Notifications
You must be signed in to change notification settings - Fork 74
6214 Голенков В.А. Лаб.2 Вар.5 #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
lab_2/main.py
Outdated
| if P >= 0.01: | ||
| check.append(True) | ||
| elif P < 0.01 or P >= 0: | ||
| check.append(False) | ||
| else: | ||
| raise ValueError("Получено некорректное значение P") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
используйте match/case
lab_2/NIST_tests.py
Outdated
| if bit == '1': | ||
| S_n += 1 | ||
| else: | ||
| S_n += -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
замените на однострочную функцию
lab_2/NIST_tests.py
Outdated
| M = 8 | ||
|
|
||
| if N < 128: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
параметры: допустимая длина последовательности, длина блока - должны передаваться в функцию, в качестве параметров
Данный тест работает и для других размерностей последовательности. Подробнее можете посмотреть в документе NIST 800-22
lab_2/NIST_tests.py
Outdated
| if max_n <= 1: | ||
| statistics[0] += 1 | ||
| elif max_n == 2: | ||
| statistics[1] += 1 | ||
| elif max_n == 3: | ||
| statistics[2] += 1 | ||
| else: | ||
| statistics[3] += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
используйте match/case
|
прочитайте файл readme п.5 |
lab_2/tools.py
Outdated
| with open(file_name, 'r', encoding="utf-8") as f: | ||
| text: str = f.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавьте обработку исключений
Было необходимо сгенерировать 2 случайные последовательности с помощью генераторов псевдослучайных чисел и проверить их с помощью тестов NIST. В папке
binary_sequencesсодержится код для 1-го этапа лабораторной работы, в файлеNIST_tests- для 2-го.В модуле
tools.pyнаходятся функции для работы с json и txt файлами. Модульmain.pyявляется точкой входа в программу и содержит в себе все необходимые вызовы функций, необходимые для выполнения задания. ФайлыReport_C++иReport_Javaхранять отчёты, в соответствии с третьим этапом лабораторной работы.