Code Monkey home page Code Monkey logo

progressive-character-encoding's Introduction

progressive-character-encoding

A new way to encode characters

Rules

  1. [0-9,a-z] is a single character key -- i.e. a or 1
  2. [A-Z] will always followed by a character -- i.e. Aa or A1
  3. [A-Z] will always have a terminating character of [0-9,a-z] -- i.e. AAAa or ABC0

Best uses when shortening a hex value

Example of hex to pce: fa0012 = Fy0i

Hex Int Pce
fa 250 Fy
00 0 0
12 18 i

Example javascript code to generate index=key mapping

var chars =['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','j','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'],
chars2 = ['A','B','C','D','E','F','J','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
idx = 0,
ctr = 0,
ctr2 = 0,
ctr3 = 0;

while(ctr < chars.length){
	console.log(idx, chars[ctr]);
  idx++;
	ctr++;
}
ctr = 0;
while(ctr2 < chars2.length){
	console.log(idx, chars2[ctr2]+chars[ctr]);
	ctr = (ctr+1) % chars.length;
  if(ctr === 0){
  	ctr2++;
  }
  idx++;
}
ctr = 0;
while(ctr3 < chars2.length){
	ctr2 = 0;
  while(ctr2 < chars2.length){
    console.log(idx, chars2[ctr3]+chars2[ctr2]+chars[ctr]);
    ctr = (ctr+1) % chars.length;
    if(ctr === 0){
      ctr2++;
    }
    idx++;
  }
	ctr3++;
}
// 5306 = "ZZy"
// 25307 = "ZZz"
// 25307 count for 3 characters will be generated up to here 
// and so on...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.