OSDN Git Service

- add crypto-js library(for new hash access method).
[feedblog/feedblog.git] / js / crypto-js / components / format-hex.js
diff --git a/js/crypto-js/components/format-hex.js b/js/crypto-js/components/format-hex.js
new file mode 100644 (file)
index 0000000..1af5da6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+CryptoJS v3.1.2
+code.google.com/p/crypto-js
+(c) 2009-2013 by Jeff Mott. All rights reserved.
+code.google.com/p/crypto-js/wiki/License
+*/
+(function (undefined) {\r
+    // Shortcuts\r
+    var C = CryptoJS;\r
+    var C_lib = C.lib;\r
+    var CipherParams = C_lib.CipherParams;\r
+    var C_enc = C.enc;\r
+    var Hex = C_enc.Hex;\r
+    var C_format = C.format;\r
+\r
+    var HexFormatter = C_format.Hex = {\r
+        /**\r
+         * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.\r
+         *\r
+         * @param {CipherParams} cipherParams The cipher params object.\r
+         *\r
+         * @return {string} The hexadecimally encoded string.\r
+         *\r
+         * @static\r
+         *\r
+         * @example\r
+         *\r
+         *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);\r
+         */\r
+        stringify: function (cipherParams) {\r
+            return cipherParams.ciphertext.toString(Hex);\r
+        },\r
+\r
+        /**\r
+         * Converts a hexadecimally encoded ciphertext string to a cipher params object.\r
+         *\r
+         * @param {string} input The hexadecimally encoded string.\r
+         *\r
+         * @return {CipherParams} The cipher params object.\r
+         *\r
+         * @static\r
+         *\r
+         * @example\r
+         *\r
+         *     var cipherParams = CryptoJS.format.Hex.parse(hexString);\r
+         */\r
+        parse: function (input) {\r
+            var ciphertext = Hex.parse(input);\r
+            return CipherParams.create({ ciphertext: ciphertext });\r
+        }\r
+    };\r
+}());\r