PageRenderTime 25ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
ActionScript | 38 lines | 23 code | 7 blank | 8 comment | 1 complexity | 291fdae9bb869c839141f655038156e4 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /**
  2. * MACs
  3. *
  4. * An enumeration of MACs implemented for TLS 1.0/SSL 3.0
  5. * Copyright (c) 2007 Henri Torgemane
  6. *
  7. * See LICENSE.txt for full license information.
  8. */
  9. package com.hurlant.crypto.tls {
  10. import com.hurlant.crypto.Crypto;
  11. import com.hurlant.crypto.hash.HMAC;
  12. import com.hurlant.crypto.hash.MAC;
  13. public class MACs {
  14. public static const NULL:uint = 0;
  15. public static const MD5:uint = 1;
  16. public static const SHA1:uint = 2;
  17. public static function getHashSize(hash:uint):uint {
  18. return [0,16,20][hash];
  19. }
  20. public static function getPadSize(hash:uint):int {
  21. return [0, 48, 40][hash];
  22. }
  23. public static function getHMAC(hash:uint):HMAC {
  24. if (hash==NULL) return null;
  25. return Crypto.getHMAC(['',"md5","sha1"][hash]);
  26. }
  27. public static function getMAC(hash:uint):MAC {
  28. return Crypto.getMAC(['', "md5", "sha1"][hash]);
  29. }
  30. }
  31. }