{"id":17489458,"url":"https://github.com/floydz/cryptanalysislib","last_synced_at":"2025-10-28T21:33:33.319Z","repository":{"id":61919480,"uuid":"438125855","full_name":"FloydZ/cryptanalysislib","owner":"FloydZ","description":"C++ STL for speed and cryptanalytic application","archived":false,"fork":false,"pushed_at":"2024-10-25T13:24:08.000Z","size":29909,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-25T16:20:48.610Z","etag":null,"topics":["cpp","crypto","cryptography"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FloydZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-14T05:12:57.000Z","updated_at":"2024-10-17T08:26:10.000Z","dependencies_parsed_at":"2024-01-21T17:23:46.969Z","dependency_job_id":"5d1308ce-3bae-4ca5-88b3-bb7ba775e1f0","html_url":"https://github.com/FloydZ/cryptanalysislib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FloydZ%2Fcryptanalysislib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FloydZ%2Fcryptanalysislib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FloydZ%2Fcryptanalysislib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FloydZ%2Fcryptanalysislib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FloydZ","download_url":"https://codeload.github.com/FloydZ/cryptanalysislib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250296537,"owners_count":21407039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","crypto","cryptography"],"created_at":"2024-10-19T05:42:53.022Z","updated_at":"2025-10-28T21:33:28.286Z","avatar_url":"https://github.com/FloydZ.png","language":"C++","readme":"This is the backbone implementation of our paper [McEliece needs a Break](https://eprint.iacr.org/2021/1634)\nand our second paper [New Time-Memory Trade-Offs for Subset-Sum](https://eprint.iacr.org/2022/1329).\n\nIdeas:\n======\n\nThis repository aims to provide a STL which a few unique tweakes:\n- Most (if not all) datastructures implemented in this library do not have a \n    delete/remove operation. Meaning you cannot delete an element once inserted\n    into the datastructure. But its possible to clear (or reset) the whole \n    datastructure at once. Which doesnt super useful in general is very useful \n    in the setting of cryptanalysis, where we only insert \"useful\" elements.\n    And after we checked if there is no (partial-) solution somewhere, we can\n    simply clear everything and start from the beginnning.\n- constexpr: All datastructure assume that you know beforehand how many elements\n    you need to insert. Or many elements you have to store at max. E.g. resizing\n    of any datastructure is not possible. Also memory will never freed.\n- HPC: All datastructure are optimized or implemented in a way to reduce \n    cache-misses.\n\nRequirements\n============\nBasically you need a `C++20` rdy compiler, `cmake 3.20`. For testing and \nbenchmarking you need `gtest` and `googlebenchmark`.\n\n## Arch Linux:\n```bash\nsudo pacman -S cmake make gtest benchmark clang\n```\n\n## Ubuntu 22.04:\n```bash\nsudo apt install libgtest-dev googletest cmake make \n```\n\nIt could be that `googletest` is not correctly installed, if so try;\n```bash\n# gtest is somehow quite difficult:\nsudo cd /usr/src/gtest\nsudo cmake .\nsudo make\nsudo cp *.a /usr/lib\n```\n\n## NixOS\n```bash\nnix-shell\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n## MacOS\n```bash\nbrew install cmake make googletest autoconf automake libtool google-benchmark gcc libomp\n```\n\nMake sure that you use `clang` for the compilation via adding `-DCMAKE_CXX_COMPILER=clang++` \nto the `cmake` command.\n\n## Windows: \nI wish you luck with this one.\n\nSupported Compilers:\n===================\n- \u003e= clang-11\n- \u003e= gcc-11\n\nSpecially gcc-10 is not supported, as it's not supporting basic concepts functionalities.\n\nHow to build\n------\n```bash\ngit clone --recurse-submodules -j4 https://github.com/FloydZ/cryptanalysislib\ncd cryptanalysislib \u0026\u0026 mkdir build \u0026\u0026 cd build \u0026\u0026 cmake .. -DCMAKE_BUILD_TYPE=Release\n```\n\n\n\nA few notes on the cmake flags:\n- for debugging you can also pass `-DCMAKE_BUILD_TYPE=Debug`.\n- if you do not pass any flag (so neither `Debug`, nor `Release`) and optimized build without SIMD will be compiled\n\n\nLabel, Value, Element, Matrix and Lists: \n========================================\nThe core concept of the main data containers of this library are `Label` and \n`Value`. A `Label` is the result of the multiplication of an (error-) vector, \ncalled `Value` with a `Matrix`. Or mathematical speaking: `Label = Matrix*Value`.\nIf you are familiar with ISD algorithms or the decoding of codewords, this looks\na lot like the syndrome equation `s = H*e`, where `s` is the sybdrome, `e` a \n(probably) unknown error and `H` the parity check matrix of your code. \n\nThis design is chosen for the case in which the error vector `e` (which is \nsaved in a `Value`) is unknown. Hence one wants to iterate a lot of Values which \nmatches the correct `Label` you can order them in a [List](TODO). As a matter \nof fact, this libraries offers of lot of different implementations. \n\nInternally a set of a `Value, Label` and `Matrix` is called an `Element`, which \nmaps each `Value` via a `Matrix` to an unique `Value`. More on each of those \ncontainers you find here: [Label](TODO), [Value](TODO), [Matrix](TODO), \n[Element]().\n\n\nImplementation Details:\n=======================\n\nThe following things are implemented:\n- Custom [allocators](./src/alloc/README.md) which do not return a memory \n    allocation, but memory blocks which do not allow for memory missuses.\n- Binary- and Fq-[Enumeration](./src/combination/README.md) which enumerate vectors of length `n` and weight \n    `w` in a loop-less efficient way. Either a [Chase](TODO)-Sequence or a \n    [Gray-Code](TODO) or a combination of both. \n- [LinkedList](./src/container/linkedlist/README.md)\n- [HashMaps](./src/container/hashmap/README.md)\n- [Permutation](./src/permutation/README.md)\n- [Search](./src/search/README.md)\n- [SIMD](./src/simd/README.md)\n\nA lot of different data containers are implemented:\n- `BinaryContainer\u003cT, len\u003e` is able to hold `len` bits in `len/(sizeof(T)*8)` \n    limbs of type `T`. Additionally, all important `add,sub,compare` functions \n    are implemented\n- `kAryType\u003cT, T2, q\u003e` represents a value `mod q`. The second type `T2` is \n    needed to sanely implement the multiplication.\n- `kAryContainer\u003cT, len\u003e` holds `len` elements `mod q` and each element is \n    saved in its own limb of type `T`. \n- `kAryPackedContainer\u003cT, len\u003e` same as `kAryContainer\u003cT, len\u003e` but the \n    implementations stores as much as possible elements `mod q` in one limb of \n    type `T`.\n\nThese datatypes can be used to instantiate a `Label` and `Value` \n(which form together an `Element\u003cValue_T, Label_T, Matrix\u003e`), where \n`Label = H \\times Value` for any Matrix `H` of any type (binary, ternary, \nkAry, ...).\nNote: only for certain primes and prime-powers are speciallized arithmetics \nimplemented. If you chose an unsupported one, a slow generic backup \nimplementation will be used. If so you will be warned.\n\nAs well as this core datatypes the following list-containers are implemented:\n- `Parallel_List` A list which separates `Value` from `Label` in two different\n    lists to allow faster enumeration of one of types while one does not care \n    about the other. Additionally, each of the two lists is split into chucks \n    on which threads can operate independent of each other. Note: sorting is \n    currently not possible in this list.\n- `Parallel_List_FullElement` Same as `Parallel_List`, but `Values` and \n    `Labels` are together saved in one list of `Elements`, which allows sorting. \n- `Parallel_List_IndexElement` TODO\n- `List` generic list implementation.\nRange checks are performed in every implementation.\n\nAll matrices are represented with the matrix class\n- [Matrix](./src/matrix/README.md)\n\nThe following sorting algorithms are available.\n-ska_sort \n-timsort\n\nCurrently `ska_sort` (Link)[https://github.com/skarupke/ska_sort] is used as \nthe main sorting algorithm. Note that sorting is avoided in the code as much \nas possible. Do not sort if you want fast code.\n\n\n\nBenchmarks\n===\nCan be found [here](https://floydz.github.io/cryptanalysislib/dev/bench/)\n\n\nTODO\n===\nexplain:\n- List generators,\n- triple\n- mccd mem tracker\n- mccl: hashmap neu streiben ohne load factor, indem die hash funk ein rotate einbaut\n- matrix: more tests via constexpr loops\n- binary_matrix aufräumen\n- Die sorting algorithmen in `list`, davon die hashfunktionen zusammenfassen \n    und die #ifdefs weg. Wahrscheinlich `parallel.h` weg? verstehe nicht so ganz was die implementierung soll, wenn ist ListT gibt.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloydz%2Fcryptanalysislib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloydz%2Fcryptanalysislib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloydz%2Fcryptanalysislib/lists"}