Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public override byte[] GetEncoded(bool compressed)
  2. {
  3. if (this.IsInfinity)
  4. {
  5. return new byte[1];
  6. }
  7.  
  8. ECPoint normed = Normalize();
  9.  
  10. byte[] X = normed.XCoord.GetEncoded();
  11.  
  12. if (compressed)
  13. {
  14. byte[] PO = new byte[X.Length + 1];
  15. PO[0] = (byte)(normed.CompressionYTilde ? 0x03 : 0x02);
  16. Array.Copy(X, 0, PO, 1, X.Length);
  17. return PO;
  18. }
  19.  
  20. byte[] Y = normed.YCoord.GetEncoded();
  21.  
  22. {
  23. byte[] PO = new byte[X.Length + Y.Length + 1];
  24. PO[0] = 0x04;
  25. Array.Copy(X, 0, PO, 1, X.Length);
  26. Array.Copy(Y, 0, PO, X.Length + 1, Y.Length);
  27. return PO;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement