You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

StreamPlainNativeEncryptor.cs 1.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Shadowsocks.Encryption.Stream
  4. {
  5. public class StreamPlainNativeEncryptor : StreamEncryptor
  6. {
  7. public StreamPlainNativeEncryptor(string method, string password) : base(method, password)
  8. {
  9. }
  10. protected override int CipherDecrypt(Span<byte> plain, Span<byte> cipher)
  11. {
  12. cipher.CopyTo(plain);
  13. return cipher.Length;
  14. }
  15. protected override int CipherEncrypt(Span<byte> plain, Span<byte> cipher)
  16. {
  17. plain.CopyTo(cipher);
  18. return plain.Length;
  19. }
  20. #region Cipher Info
  21. private static readonly Dictionary<string, CipherInfo> _ciphers = new Dictionary<string, CipherInfo>
  22. {
  23. {"plain", new CipherInfo("plain", 0, 0, CipherFamily.Plain) },
  24. };
  25. public static Dictionary<string, CipherInfo> SupportedCiphers()
  26. {
  27. return _ciphers;
  28. }
  29. protected override Dictionary<string, CipherInfo> getCiphers()
  30. {
  31. return _ciphers;
  32. }
  33. #endregion
  34. }
  35. }