JavaScript È°¿ëÆÁ
2017.05.29 / 10:20

Javascript ¾Ïȣȭ Çϱâ

½Å´Ïºñ
Ãßõ ¼ö 368

Javascript ·Î ¾Ïȣȭ ÇÒ ÀÏÀÌ »ý°Ü¼­ Search Áß ¹ß°ß Çß´Ù.


¡Ø github - https://github.com/tomyun/crypto-js


º¸Åë ¼­¹ö¿¡¼­ ¾Ïȣȭ ÀÛ¾÷À» Çϰųª, SSL À» »ç¿ë ÇÏ´Â´ë ¾î¿ ¼ö ¾øÀÌ ¾Ïȣȭ ¸¦ ÇÏ´Â Á¡µµ Àִ°Š°°´Ù.


´Ü¹æÇâ ¾Ïȣȭ ¾Ë°í¸®Áò »ç¿ë¿¡´Â Æí¸® ÇÑ°Í °°´Ù. 


Àû¿ë ¹æ¹ý

¼Ò½º ´Ù¿î ÈÄ ¾Æ·¡¿Í °°ÀÌ Àû¿ë ÇÑ´Ù. ´Ù¸¥ ¾Ë°í¸®ÁòÀ» »ç¿ëÇÒ °æ¿ì ´Ù¸¥ js¸¦ »ç¿ë ÇÑ´Ù.


<script type="text/javascript" src="/core.js"></script>
<script type="text/javascript" src="/sha256.js"></script>

CryptoJS.SHA256('test').toString()



Ãâó: http://blog.whitelife.co.kr/177 [White Life Story]




CryptoJS

This repository is a mirror of crypto-js from Google Code. Its full history has been converted with svn2git, yet it is not guaranteed to track more recent changes. Other than that, several branches have been created for working on some extra stuffs.

SEED

SEED-128 is a block cipher which shows extensive and exclusive use in South Korea. It features a so-called Feistel network seemingly not very different from other predecessors like DES. If necessary, various options including IV, block modes, and/or padding, can be specified as original CryptoJS syntax.

<script src="https://rawgithub.com/tomyun/crypto-js/seed-3.1.2/build/rollups/seed.js"></script>
<script>
    var encrypted = CryptoJS.SEED.encrypt("Message", "Secret Passphrase");
    var decrypted = CryptoJS.SEED.decrypt(encrypted, "Secret Passphrase");
</script>

CP949

CP949 is a character encoding for Korean language. In the current UTF-8 era, it still has widespread adoption among many domestic corporate sites. In short, there are plenty of seed-encrypted packets whose source is in CP949. Be cautious of its insane filesize: ~170 kB

<script src="https://rawgithub.com/tomyun/crypto-js/seed-3.1.2/src/enc-cp949.js"></script>
<script>
    var words = CryptoJS.enc.CP949.parse('?îÁd');
    var cp949 = CtyptoJS.enc.CP949.stringify(words);
</script>

PBKDF1

PBKDF1 is a key derivation function superseded by more robust PBKDF2. While any supported hash functions can be used, keys longer than the hash digest cannot be derived.

<script src="https://rawgithub.com/tomyun/crypto-js/xeit-3.1.2/build/rollups/pbkdf1.js"></script>
<script>
    var salt = CryptoJS.lib.WordArray.random(128/8);
    var sha1 = CryptoJS.algo.SHA1;
    var key = CryptoJS.PBKDF1("Secret Passphrase", salt, { keySize: 128/32, hasher: sha1, iterations: 1000 });
</script>

RC2

RC2 is a block cipher whose details were kept secret for a decade. Although it has been superseded by many other recent algorithms, there are some legacy systems still dependent on. The effective key length is 32 bits by default, while it can be specified up to 1024 bits.

<script src="https://rawgithub.com/tomyun/crypto-js/xeit-3.1.2/build/rollups/rc2.js"></script>
<script>
    var encrypted = CryptoJS.RC2.encrypt("Message", "Secret Passphrase", { effectiveKeyBits: 64 });
    var decrypted = CryptoJS.RC2.decrypt(encrypted, "Secret Passphrase", { effectiveKeyBits: 64 });
</script>