Compare commits
No commits in common. "3ebb5a08ecf982c10a18c0596be4bb2549a815c9" and "4171e92bec6e76cd9410045653f5e705b6ba5457" have entirely different histories.
3ebb5a08ec
...
4171e92bec
@ -1,40 +0,0 @@
|
|||||||
<!--
|
|
||||||
This is part of WHY2
|
|
||||||
Copyright (C) 2022 Václav Šmejkal
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# why2_random
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Identifier | Data type |
|
|
||||||
| ---------- | --------- |
|
|
||||||
| `dest` | `void *` |
|
|
||||||
| `size` | `size_t` |
|
|
||||||
|
|
||||||
## Attributes
|
|
||||||
|
|
||||||
| | |
|
|
||||||
| ------------------ | -------------------------------------------------------- |
|
|
||||||
| **Return type** | [`why2_bool`](../../../../types/core/flags/why2_bool) |
|
|
||||||
| **Header comment** | `WRITE CRYPTO-SECURE RANDOM NUMBER INTO dest` |
|
|
||||||
| **Added in commit** | [`f95608f52a0a82b3a8c005c7f8dad0b9cf93202a`](https://github.com/ENGO150/WHY2/commit/f95608f52a0a82b3a8c005c7f8dad0b9cf93202a) |
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Function passes `dest` and `size` into [`RAND_bytes`](https://docs.openssl.org/1.1.1/man3/RAND_bytes) function and gets the output value. If output value is equal to `1`, returns `true`, otherwise `false`.
|
|
||||||
|
|
||||||
`dest` is where the output value should be stored, `size` sets the allowed size to write. Should be `sizeof(dest_datatype)`.
|
|
@ -1,37 +0,0 @@
|
|||||||
<!--
|
|
||||||
This is part of WHY2
|
|
||||||
Copyright (C) 2022 Václav Šmejkal
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# why2_seed_random
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Identifier | Data type |
|
|
||||||
| ---------- | ---------------- |
|
|
||||||
| `seed` | `unsigned long` |
|
|
||||||
|
|
||||||
## Attributes
|
|
||||||
|
|
||||||
| | |
|
|
||||||
| ------------------ | -------------------------------- |
|
|
||||||
| **Return type** | `void` |
|
|
||||||
| **Header comment** | `SEED why2_seeded_random OUTPUT` |
|
|
||||||
| **Added in commit** | [`25113dc0b3c97178c85ac02c082164a6d36d3c1e`](https://github.com/ENGO150/WHY2/commit/25113dc0b3c97178c85ac02c082164a6d36d3c1e) |
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Function inits pseudo random number generator `struct` with `seed`. Seeded numbers can be used with [`why2_seeded_random`](../why2_seeded_random). Also, there is no need to deallocate the PRNG.
|
|
@ -1,35 +0,0 @@
|
|||||||
<!--
|
|
||||||
This is part of WHY2
|
|
||||||
Copyright (C) 2022 Václav Šmejkal
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# why2_seeded_random
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
*This functions doesn't take any parameters.*
|
|
||||||
|
|
||||||
## Attributes
|
|
||||||
|
|
||||||
| | |
|
|
||||||
| ------------------ | ----------------------------------------------------------------- |
|
|
||||||
| **Return type** | `int` |
|
|
||||||
| **Header comment** | `GENERATE RANDOM NUMBER BASED ON SEED PASSED IN why2_seed_random` |
|
|
||||||
| **Added in commit** | [`25113dc0b3c97178c85ac02c082164a6d36d3c1e`](https://github.com/ENGO150/WHY2/commit/25113dc0b3c97178c85ac02c082164a6d36d3c1e) |
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Function generates pseudo random `int` with PRNG created in [`why2_seed_random`](../why2_seed_random). The function uses OpenSSL's [`HMAC`](https://docs.openssl.org/1.1.1/man3/HMAC).
|
|
@ -34,7 +34,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
Function takes `input` parameter and divides it into segments of [`WHY2_SUM_SEGMENT_SIZE`](../../../../macros/core/crypto/why2_sum_segment_size). Each segment does some xoring, math using [`WHY2_SUM_BASE_PRIME`](../../../../macros/core/crypto/why2_sum_base_prime) and modulates each segment with [`WHY2_SUM_MOD_PRIME`](../../../../macros/core/crypto/why2_sum_mod_prime). The result is then added together and returned.
|
Function takes `input` parameter and divides it into segments of [`WHY2_SUM_SEGMENT_SIZE`](../../../../macros/core/crypto/why2_sum_segment_size.md). Each segment does some xoring, math using [`WHY2_SUM_BASE_PRIME`](../../../../macros/core/crypto/why2_sum_base_prime.md) and modulates each segment with [`WHY2_SUM_MOD_PRIME`](../../../../macros/core/crypto/why2_sum_mod_prime.md). The result is then added together and returned.
|
||||||
|
|
||||||
Output value grows rapidly with increasing `input` length, but unless you are using enormously large keys, nothing should overflow. Function was tested with lengths up to 4096 chars and output was only about 0,0000014 % of the `ULL` range.
|
Output value grows rapidly with increasing `input` length, but unless you are using enormously large keys, nothing should overflow. Function was tested with lengths up to 4096 chars and output was only about 0,0000014 % of the `ULL` range.
|
||||||
|
|
||||||
|
@ -26,10 +26,7 @@ You can find documentation for every *public* function of WHY2 below.
|
|||||||
|
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
| ------------------------------------------------------- | ------------------------------------------------ |
|
| ------------------------------------------------------- | ------------------------------------------------ |
|
||||||
| [`why2_sum_segment`](./core/crypto/why2_sum_segment) | Calculate SUM++ for input; Used for padding seed |
|
| [`why2_sum_segment`](./core/crypto/why2_sum_segment.md) | Calculate SUM++ for input; Used for padding seed |
|
||||||
| [`why2_random`](./core/crypto/why2_random) | Write crypto-secure random number into dest |
|
|
||||||
| [`why2_seed_random`](./core/crypto/why2_seed_random) | Seed why2_seeded_random output |
|
|
||||||
| [`why2_seeded_random`](./core/crypto/why2_seeded_random) | GENERATE RANDOM NUMBER BASED ON SEED PASSED IN why2_seed_random |
|
|
||||||
|
|
||||||
## Logger
|
## Logger
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user