{"id":29407215,"url":"https://github.com/oxarbitrage/salsa20-ecrypt-vectors-converter","last_synced_at":"2025-07-11T00:41:22.710Z","repository":{"id":196100919,"uuid":"694346946","full_name":"oxarbitrage/salsa20-ecrypt-vectors-converter","owner":"oxarbitrage","description":"Convert ECRYPT salsa20 test vectors to JSON.","archived":false,"fork":false,"pushed_at":"2023-09-24T20:27:10.000Z","size":111,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-09-25T05:41:37.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxarbitrage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-20T20:17:32.000Z","updated_at":"2023-09-24T20:28:41.000Z","dependencies_parsed_at":"2023-09-21T10:36:34.649Z","dependency_job_id":null,"html_url":"https://github.com/oxarbitrage/salsa20-ecrypt-vectors-converter","commit_stats":null,"previous_names":["oxarbitrage/salsa20-ecrypt-vectors-converter"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/oxarbitrage/salsa20-ecrypt-vectors-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fsalsa20-ecrypt-vectors-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fsalsa20-ecrypt-vectors-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fsalsa20-ecrypt-vectors-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fsalsa20-ecrypt-vectors-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxarbitrage","download_url":"https://codeload.github.com/oxarbitrage/salsa20-ecrypt-vectors-converter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fsalsa20-ecrypt-vectors-converter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264697577,"owners_count":23650957,"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":[],"created_at":"2025-07-11T00:41:21.997Z","updated_at":"2025-07-11T00:41:22.691Z","avatar_url":"https://github.com/oxarbitrage.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Converting Salsa20 ECRYPT test vectors to JSON\n\nConvert old NESSIE format ECRYPT Salsa20 test vectors to more friendly JSON files containing the same data.\n\n## Motivation\n\nThe [Salsa20 spec](https://cr.yp.to/snuffle/spec.pdf) provides test vectors for different parts of the protocol but do not provide any vectors for the encryption function.\n\nThe [eSTREAM project](https://www.ecrypt.eu.org/stream/) was a multi-year project to promote efficient and compact stream ciphers designs. As part of this effort the [Salsa20/12](https://www.ecrypt.eu.org/stream/e2-salsa20.html) cipher was analized and by this, a good amount of test vectors for the encryption function were created.\n\nThis is an old project and we were not able to find the test vectors in the official site. The following 2 files are what i think were the official test vectors:\n\n- Original test vector 128 bits key file: [salsa20-128.64-verified.test-vectors](https://github.com/das-labor/legacy/blob/master/microcontroller-2/arm-crypto-lib/testvectors/salsa20-128.64-verified.test-vectors)\n- Original test vector 256 bits key file: [salsa20-256.64-verified.test-vectors](https://github.com/das-labor/legacy/blob/master/microcontroller-2/arm-crypto-lib/testvectors/salsa20-256.64-verified.test-vectors)\n\nThe goal of this small project is to convert those test vectors that ([seems to be](https://crypto.stackexchange.com/questions/81087/ecrypt-salsa20-test-vectors-interpretation)) [NESSIE format](https://www.ecrypt.eu.org/stream/perf/#overview) to JSON so more modern Salsa20 implementations can use them easily.\n\n## Preparation\n\nWe downloaded the two files with test vectors listed in the previous section into the project ([salsa20-128.64-verified.test-vectors](salsa20-128.64-verified.test-vectors) and [salsa20-256.64-verified.test-vectors](salsa20-256.64-verified.test-vectors)) as a starting point.\n\nThen we found a [salsa20 C implementation](https://github.com/alexwebr/salsa20) that is actually using this test vectors and served as an inspiration for this project.\n\nFirst, the implementation trims the header and the tail of the original files and so we do. Our test vector files now are:\n\n- Trimmed test vector 128 bits key file: [test_vectors.128](https://github.com/alexwebr/salsa20/blob/master/test_vectors.128)\n- Trimmed test vector 256 bits key file: [test_vectors.256](https://github.com/alexwebr/salsa20/blob/master/test_vectors.256)\n\nWe downloadeed this files and are now part of the project too: [test_vectors.128](test_vectors.128) and [test_vectors.256](test_vectors.256)\n\nIt is easy to compare and see no test data was modified but just file header and tail information was removed from one version to the other:\n\n```bash\n% diff salsa20-256.64-verified.test-vectors test_vectors.256\n1,12d0\n\u003c \n\u003c Primitive Name: Salsa20\n\u003c =======================\n\u003c Profile: S3___\n\u003c Key size: 256 bits\n\u003c IV size: 64 bits\n\u003c \n\u003c Test vectors -- set 1\n\u003c =====================\n\u003c \n\u003c (stream is generated by encrypting 512 zero bytes)\n\u003c \n2603,2605d2590\n\u003c \n\u003c \n\u003c End of test vectors\n% diff salsa20-128.64-verified.test-vectors test_vectors.128\n1,15d0\n\u003c ********************************************************************************\n\u003c *                          ECRYPT Stream Cipher Project                        *\n\u003c ********************************************************************************\n\u003c \n\u003c Primitive Name: Salsa20\n\u003c =======================\n\u003c Profile: S3___\n\u003c Key size: 128 bits\n\u003c IV size: 64 bits\n\u003c \n\u003c Test vectors -- set 1\n\u003c =====================\n\u003c \n\u003c (stream is generated by encrypting 512 zero bytes)\n\u003c \n2167,2170d2151\n\u003c \n\u003c \n\u003c End of test vectors\n\u003c \n% \n```\nThe C implementaion use shell scripts for generating unit tests from the test vector files. One for each type: [vectors_to_tests_128.sh](https://github.com/alexwebr/salsa20/blob/master/vectors_to_tests_128.sh) and [vectors_to_tests_256.sh](https://github.com/alexwebr/salsa20/blob/master/vectors_to_tests_256.sh)\n\nWe do a similar approach here but converting from the test files to JSON in [vectors_to_json.sh](vectors_to_json.sh).\n\nThe purpose of trimming the original test vector files is for the shell script to don't have to do it. The script will fail if the original files are not trimmed as specified in this section.\n\n## Usage\n\nTo convert the test vectors to JSON for 128-bit keys:\n```bash\n./vectors_to_json.sh 128 test_vectors.128 test_vectors_128.json\n```\n\nTo convert the test vectors to JSON for 256-bit keys:\n```bash\n./vectors_to_json.sh 256 test_vectors.256 test_vectors_256.json\n```\n\n## New JSON tests vectors\n\nFeel free to use them in any way.\n\n- JSON test vector 128 bits key file: [test_vectors_128.json](test_vectors_128.json)\n- JSON test vector 128 bits key file: [test_vectors_256.json](test_vectors_256.json)\n\n## Where this files are being used?\n\nThis test vectors are known to be used in the [Haskell Salsa20 ECRYPT unit tests](https://github.com/oxarbitrage/hsalsa20/tree/main/test/unit/ecrypt).\n\nIf you find this repositoty usfeul please let us know in an issue or pull request. We will be happy to include your use case in this section.\n\n## Licence\n\nThis repository is under the [MIT](LICENSE) license.\n\n## References\n\n- Salsa20 spec: https://cr.yp.to/snuffle/spec.pdf\n- ECRYPT: https://www.ecrypt.eu.org/\n- eSTREAM project: https://www.ecrypt.eu.org/stream/\n- eSTREAM Salsa20/12: https://www.ecrypt.eu.org/stream/e2-salsa20.html\n- ECRYPT Salsa20 Test Vectors Interpretation: https://crypto.stackexchange.com/questions/81087/ecrypt-salsa20-test-vectors-interpretation\n- NESSIE format: https://www.ecrypt.eu.org/stream/perf/#overview\n- Salsa20 C implementation: https://github.com/alexwebr/salsa20/\n- Haskell Salsa20: https://github.com/oxarbitrage/hsalsa20","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Fsalsa20-ecrypt-vectors-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxarbitrage%2Fsalsa20-ecrypt-vectors-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Fsalsa20-ecrypt-vectors-converter/lists"}