From 4171e92bec6e76cd9410045653f5e705b6ba5457 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 25 Jan 2025 15:01:00 +0100 Subject: [PATCH] created doc for why2_sum_segment --- .../functions/core/crypto/why2_sum_segment.md | 41 +++++++++++++++++++ docs/functions/index.md | 33 +++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 docs/functions/core/crypto/why2_sum_segment.md create mode 100644 docs/functions/index.md diff --git a/docs/functions/core/crypto/why2_sum_segment.md b/docs/functions/core/crypto/why2_sum_segment.md new file mode 100644 index 0000000..d8f60bc --- /dev/null +++ b/docs/functions/core/crypto/why2_sum_segment.md @@ -0,0 +1,41 @@ + + +# why2_sum_segment + +## Parameters + +| Identifier | Data type | +| ---------- | --------- | +| `input` | `char *` | + +## Attributes + +| | | +| ------------------ | -------------------------------------------------- | +| **Return type** | `unsigned long long` | +| **Header comment** | `CALCULATE SUM++ FOR input; USED FOR PADDING SEED` | +| **Added in commit** | [`fb2ac1a7bbcb6f7291f4e89576e1b7f5c1d6fd06`](https://github.com/ENGO150/WHY2/commit/fb2ac1a7bbcb6f7291f4e89576e1b7f5c1d6fd06) | + +## Description + +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. + +This function isn't designed to be completely cryptographically secure! It is meant only for converting string of key into `ULL` with as few collisions as possible. \ No newline at end of file diff --git a/docs/functions/index.md b/docs/functions/index.md new file mode 100644 index 0000000..12eca22 --- /dev/null +++ b/docs/functions/index.md @@ -0,0 +1,33 @@ + + +# Functions + +You can find documentation for every *public* function of WHY2 below. + +## Core + +### Crypto.h + +| Function | Description | +| ------------------------------------------------------- | ------------------------------------------------ | +| [`why2_sum_segment`](./core/crypto/why2_sum_segment.md) | Calculate SUM++ for input; Used for padding seed | + +## Logger + +## Chat \ No newline at end of file