unicodeOverflowVariations

This tag generates multiple variations of unicode overflows.

Created by: hackvertor
Installed 1 times

Category: Charsets

Created on: Tuesday, September 17, 2024 at 12:11:12 PM

Updated on: Monday, December 30, 2024 at 12:54:30 AM

This is a built in tag
Tag arguments
[
   {
      "type": "number",
      "help": "Provides the maximum codepoint",
      "defaultValue": "0xfff"
   }
]
Code
class unicodeOverflowVariations {
  encode(input, max) {
      if(max > 0xffff) {
        throw new Error("Max parameter is too large");
     }
  return input.split('').map(chr => {
	let characters = '';
	for(let i=chr.codePointAt()+1;i<=max;i++){
		if(i % 256 === chr.codePointAt()) {
			characters += String.fromCodePoint(i);
		}
	}
	return characters;}).join('');
  }
}