mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Initial commit
This commit is contained in:
commit
b1d73a725d
238 changed files with 105357 additions and 0 deletions
55
src/js/operations/Punycode.js
Executable file
55
src/js/operations/Punycode.js
Executable file
|
@ -0,0 +1,55 @@
|
|||
/* globals punycode */
|
||||
|
||||
/**
|
||||
* Punycode operations.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
var Punycode = {
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
IDN: false,
|
||||
|
||||
/**
|
||||
* To Punycode operation.
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run_to_ascii: function(input, args) {
|
||||
var idn = args[0];
|
||||
|
||||
if (idn) {
|
||||
return punycode.ToASCII(input);
|
||||
} else {
|
||||
return punycode.encode(input);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* From Punycode operation.
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run_to_unicode: function(input, args) {
|
||||
var idn = args[0];
|
||||
|
||||
if (idn) {
|
||||
return punycode.ToUnicode(input);
|
||||
} else {
|
||||
return punycode.decode(input);
|
||||
}
|
||||
},
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue