libsodium crypto_stream_salsa20_xor的输入和输出缓冲区相同

时间:2015-11-25 09:14:08

标签: c cryptography libsodium

我想知道为crypto_stream_salsa20_xor提供与明文和密文相同的缓冲区是否安全。我试图查看源文件。 crypto_stream_salsa20_xor使用crypto_core_salsa20,但此功能仅出现在头文件中:

grep -r "int crypto_core_salsa" libsodium-1.0.5
libsodium-1.0.5/src/libsodium/include/sodium/crypto_core_salsa2012.h:int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
libsodium-1.0.5/src/libsodium/include/sodium/crypto_core_salsa208.h:int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
libsodium-1.0.5/src/libsodium/include/sodium/crypto_core_salsa20.h:int crypto_core_salsa20(unsigned char *out, const unsigned char *in,

1 个答案:

答案 0 :(得分:1)

是的,这样做是安全的。这也适用于图书馆提供的其他密码。输入和输出缓冲区可以相同。