Class ChaCha20CryptoProvider
ChaCha20-Poly1305 加密提供者(使用 BouncyCastle 实现)
public class ChaCha20CryptoProvider : ICryptoProvider, IDisposable
- Inheritance
-
ChaCha20CryptoProvider
- Implements
- Inherited Members
Remarks
性能优化:
- 使用静态 SecureRandom 实例避免重复创建
- 使用 ArrayPool 减少内存分配
Constructors
ChaCha20CryptoProvider(byte[])
public ChaCha20CryptoProvider(byte[] key)
Parameters
keybyte[]
ChaCha20CryptoProvider(string)
public ChaCha20CryptoProvider(string base64Key)
Parameters
base64Keystring
Methods
Decrypt(string)
解密密文
public string Decrypt(string cipherText)
Parameters
cipherTextstring密文(Base64 编码)
Returns
- string
明文
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Encrypt(string)
加密明文
public string Encrypt(string plainText)
Parameters
plainTextstring明文
Returns
- string
密文(Base64 编码)