ale-depi/urca

GitHub: ale-depi/urca

URCA是一个提供加密原语向量化实现的研究工具,用于批量测试和统计分析。

Stars: 1 | Forks: 0

# URCA **U**nified **R**esource for **C**ryptographic **A**rrays Official logo URCA项目旨在提供众多密码学原语的向量化实现,以便于研究其统计特性。 不仅如此,由于研究原语的简化版本有时也很有用,URCA项目尝试提供原语的通用化版本。 该项目分别为CPU和GPU实现了向量化实现,分别使用 [NumPy](https://numpy.org/) 和 [CuPy](https://cupy.dev/)。 ## 页面 [文档](https://ale-depi.github.io/urca/) [用户指南](https://ale-depi.github.io/urca/guide/user.html) [开发者指南](https://ale-depi.github.io/urca/guide/developer.html) ## 示例 可以同时加密多个明文。 ``` >>> import numpy as np >>> from urca.cpu.blocks.speck import Speck >>> speck = Speck(32, 64) >>> word_type = speck.word_type >>> texts = np.array([[0x6574, 0x694C], [0x0000, 0x0000]], dtype=word_type) >>> keys = np.array([[0x1918, 0x1110, 0x0908, 0x0100], [0x0000, 0x0000, 0x0000, 0x0000]], dtype=word_type) >>> speck.encrypt(texts, keys, 0, 22) >>> np.vectorize(hex)(texts) array([['0xa868', '0x42f2'], ['0x2bb9', '0xc642']], dtype='>> import random >>> import numpy as np >>> from urca.cpu.blocks.speck import Speck >>> primitive = Speck(32, 64) >>> word_size = primitive.word_size >>> word_type = primitive.word_type >>> n_text_words = primitive.n_text_words >>> n_key_words = primitive.n_key_words >>> n_instances = 4 >>> texts = [[random.getrandbits(word_size) for _ in range(n_text_words)] for _ in range(n_instances)] >>> texts = np.array(texts, dtype=word_type) >>> keys = [[random.getrandbits(word_size) for _ in range(n_key_words)] for _ in range(n_instances)] >>> keys = np.array(keys, dtype=word_type) >>> primitive.encrypt(texts, keys, 0, 22) >>> np.vectorize(hex)(texts) # array([['0x3068', '0xc0bf'], # ['0xb30b', '0xbed8'], # ['0xbb16', '0xece6'], # ['0x921a', '0x6f0a']], dtype='
标签:CuPy, NumPy, Python, 加密, 加密算法研究, 向量化计算, 安全, 密码原语, 密码学, 并行计算, 性能优化, 手动系统调用, 批量加密, 数据加密, 无后门, 检测绕过, 漏洞扫描器, 算法库, 统计分析, 计算密码学, 超时处理, 逆向工具, 通用实现