Skip to content

Transcode a integer from and to base 10 to a alphanumerical handwritten-proof base

Notifications You must be signed in to change notification settings

dascritch/BaseRef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base Ref

Utilities to transcode a integer from and to base 10 to a alphanumerical base where the handwritten numbers won't have potential homoglyphes. It was first developed in a defunct service called “dAgence” as base 33 for generating command references, hence the “base ref” name. It is actually a base 28.

This project is just an exercice (TDD and implementation in numerous languages), but you can use it and fork it. A work-in-progress (french written) post will be published during autumn 2014.

But if you find it really useful, I'll be happy.

Author : Xavier "dascritch" Mouton-Dubosc

Contributors :

Blogged about it there (in French):

  1. Relire un numéro de commande écrit à la main

Principles

The “conventionnal” base 36 uses numbers then letters : 0123456789ABCDEFHIJKLMNOPQRSTUVWXYZ

I'm removing any letter that may be confused with numbers when (badly) handwritten :BGILOSYZ

We have 28 available glyphes : 0123456789ACDEFHJKMNPQRTUVWX

Do you read E55S or EGGS ? https://twitter.com/ldodds/status/492965240657944576

Intentions

  • Coding rules are : TDD, DRY, safe
  • Is it possible to do TDD in various languages with only one specification file ?
  • Do tests suite have different behaviours ?
  • What language is smartest to read afterwards ?
  • Ok, it's OOP, but have we smartests patterns ?
  • How Json is decoded ?

API

The class should implements :

  • isValid(string)
  • true : if a string has the glyphes even lowercase or a empty string
  • false : elsewhere
  • encode(absolute integer)
  • string : the translated string
  • false : if not an absolute integer, like real or negative numbers or NaN
  • decode(string)
  • integer : the transcoded number
  • false : if not translatable It may have an exception for debug purposes

Implementations

  • Javascript (with QUnit and Jasmine)
  • Python 3
  • PHP (with Atoum)
  • Ruby 1.9.3
  • C# (by Christopher Maneu)

Licence

Copyright (C) 2014 Xavier "dascritch" Mouton-Dubosc

This software is licenced under the GNU General Purpose Licence. Use it and deploy it as you want : i've done too much closed source before.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Versions

Repository : https://github.com/dascritch/BaseRef

Keeping in touch

About

Transcode a integer from and to base 10 to a alphanumerical handwritten-proof base

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published