MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / Utf8Encode

Function Utf8Encode

src/includes/functions/cryptography/md5.js:108–130  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

106 }
107
108 function Utf8Encode(string) {
109 string = string.replace(/\r\n/g, "\n");
110 let utftext = "";
111
112 for (let n = 0; n < string.length; n++) {
113
114 const c = string.charCodeAt(n);
115
116 if (c < 128) {
117 utftext += String.fromCharCode(c);
118 } else if ((c > 127) && (c < 2048)) {
119 utftext += String.fromCharCode((c >> 6) | 192);
120 utftext += String.fromCharCode((c & 63) | 128);
121 } else {
122 utftext += String.fromCharCode((c >> 12) | 224);
123 utftext += String.fromCharCode(((c >> 6) & 63) | 128);
124 utftext += String.fromCharCode((c & 63) | 128);
125 }
126
127 }
128
129 return utftext;
130 }
131
132 let k;
133 let AA;

Callers 3

md5.jsFile · 0.70
md5Method · 0.50
sha256Method · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected