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.

StreamPlainNativeCrypto.cs 1.2 kB

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Shadowsocks.Crypto.Stream
  4. {
  5. public class StreamPlainNativeCrypto : StreamCrypto
  6. {
  7. public StreamPlainNativeCrypto(string method, string password) : base(method, password)
  8. {
  9. }
  10. protected override int CipherDecrypt(Span<byte> plain, ReadOnlySpan<byte> cipher)
  11. {
  12. cipher.CopyTo(plain);
  13. return cipher.Length;
  14. }
  15. protected override int CipherEncrypt(ReadOnlySpan<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. {"none", new CipherInfo("none", 0, 0, CipherFamily.Plain) },
  25. };
  26. public static Dictionary<string, CipherInfo> SupportedCiphers()
  27. {
  28. return _ciphers;
  29. }
  30. protected override Dictionary<string, CipherInfo> GetCiphers()
  31. {
  32. return _ciphers;
  33. }
  34. #endregion
  35. }
  36. }