Browse Source

Генерация случайного ключа

master
commit
f2f3d0038f
  1. 24
      LICENSE
  2. 5
      README.md
  3. 8
      brython.min.js
  4. 3
      brython_stdlib.js
  5. 72
      random_key_generator.html

24
LICENSE

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

5
README.md

@ -0,0 +1,5 @@
# Программа генерации случайного ключа
* В программе можно выбрать на основе каких символов сгенерировать ключ (по умолчанию используется HEX символы)
* Возможно выбрать длину генерируемого ключа
* При каждом нажатии кнопки генерируется новый ключ

8
brython.min.js vendored

File diff suppressed because one or more lines are too long

3
brython_stdlib.js

File diff suppressed because one or more lines are too long

72
random_key_generator.html

@ -0,0 +1,72 @@
<!-- Copyright 2023 by Alexei Bezborodov <AlexeiBv+mirocod_wave_reflection@narod.ru> -->
<!-- public domain -->
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Генерация ключа</title>
<!--
Загрузка скриптов из интернета
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.8.9/brython.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.8.9/brython_stdlib.js"></script>
-->
<!--
Загрузка скриптов из локальной папки (рядом с файлом html)
-->
<script type="text/javascript" src="brython.min.js"></script>
<script type="text/javascript" src="brython_stdlib.js"></script>
</head>
<body onload="brython()">
<h1 class="text-center">Генерация случайного ключа</h1>
Символы для генерации ключа
<input id = "words" value="0123456789ABCDEF"/>
<br/>
Размер ключа
<select size="1" id="key_size">
<option>64</option>
<option>128</option>
<option selected="selected">256</option>
<option>512</option>
</select>
<br/>
<input type="button" id="gen_key" value="Сгенерировать ключ"></input>
<p id="output"></p>
<script type="text/python">
from browser import document, html, window
import random, math
def base_func(x, omega):
return math.sin(x + omega)
def gen_key(size):
result = ''
words = document["words"].value
for i in range(size // 4):
result += words[random.randint(0, len(words) - 1)]
return result
def gen_key_event(event):
document["output"].innerHTML = gen_key(int(document["key_size"].value))
document["gen_key"].bind("click", gen_key_event)
</script>
</body>
</html>
Loading…
Cancel
Save