问题描述
我发现很多在C AES,Twofish算法的实现和蛇,但我真的不明白的例子。我只知道,一些地方用实例向反转矩阵。
I found a lot of implementations of AES, Twofish and Serpent in C. But I don't really understand the examples. I only understand that some where provided with examples to invert a matrix.
有人点我一个例子或.c文件的加密/解密的数据再由的char * psented $ P $
和密码?
Can someone point me to an example or .c file for to encrypt/decrypt data represented by a char*
and a password?
推荐答案
Wikipedia文章实际上是链接到一个优秀的(由)引导您完成了数学和提供在旅途中,这是理解的过程中非常有用C实现。我也建议你阅读了在。
The wikipedia article actually links to an excellent tutorial (by X-N20) written in C that walks you through the Maths and provides C implementations on the go, which is quite useful for understanding the process. I'd also recommend reading up on finite field arithmetic.
并的,其对AES标题错过了,是不是在互联网做到有据可查。但请记住,每个提供参考实现。
Serpent and Twofish, having missed out on the AES title, aren't so well documented around the internet. Remember though that each provides reference implementations.
实际执行自己都需要对各自的论文研究,大概参考源$ C $ C。
Actually implementing them yourself will require study of their respective papers and probably the reference source code.
请注意,20个您十亿意见的所有涉及到的事实的AES中指定的接口的NIST是每个密码提供一个128位(16字节)的输入块和128位,192位和256位中的一个键块。
Note that your 20 billion comments all relate to the fact that the interface NIST specified for AES was that each cipher provide a 128-bit (16 byte) input block and one of 128-bit, 192-bit and 256-bit key blocks.
为了在以妥善抵抗密码分析这样一种方式安全加密,你需要一些细致的工作。例如,如果你的最后一块缺什么几个字节需要的?你怎么垫牢固?同样,根据不同的使用目的还有其他的计划,尤其是大的重复数据,设计用来抵御密码分析,你知道,加密的数据可能包含说 C的内容:\\ WINDOWS
。什么是评论者正试图获得在的是,任何真实世界的使用情况,保持安全,这些东西需要考虑。
In order to securely encrypt in such a way as to resist cryptanalysis properly, you need some careful work. For example, what if your last block is missing a few bytes needed? How do you pad securely? Similarly, depending on the intended usage there are other schemes, particularly for large repetitive data, designed to resist cryptanalysis where you know that the encrypted data likely contains say the contents of c:\windows
. What the commentors are trying to get at is that for any real world usage, to remain secure, these things need consideration.
修改由于另一个问题也随之而来,关于这一主题,这里的几个环节:
Edit Since another question has cropped up on this topic, here's a few links:
- -algorithms包括AES,SHA和蛇。
- 。另请参见。他们没有实现的毒蛇。你可能也想看看自己的code其余下的
加密
。 - 。如果你能使用C ++,并且仅加密的最终用户,那么你需要这个库(TM)。有在那里我从来没有听说过的算法。他们。
- 提供的加密功能
整体浴室的GPG
。特别是,如果你是AES后,你可能不会发现它在这里,但你会发现茶花和蛇。
- Brian Gladman's ASM/C code for various crypto-algorithms including AES, SHA and Serpent.
- OpenSSL's AES code in their CVS. See also DES. They don't implement Serpent. You might also want to look at the rest of their code under
crypto
. - Crypto++. If you can use C++ and are only an end-user of crypto, then You Need This Library (tm). There are algorithms in there I've never heard of. Their SVN trunk.
- libgcrypt provides a whole suite of cryptographic functions for
gpg
. Specifically, if you're after AES, you might not find it in here, but you will find camellia and serpent.
这篇关于AES,蛇和Twofish的用C的例子吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!