Skip to content

Instantly share code, notes, and snippets.

@nikoloza
Last active March 15, 2016 03:38
Show Gist options
  • Save nikoloza/da926676fee81bea4533 to your computer and use it in GitHub Desktop.
Save nikoloza/da926676fee81bea4533 to your computer and use it in GitHub Desktop.
ROT13 variation for Georgian Alphabet.
String.prototype.rot17 = function() {
return this.replace(/[ა-ჱ]/g, function(c) {
c = c.charCodeAt() + 17;
return String.fromCharCode(c <= 4337 ? c : c - 34);
});
};
@nikoloza
Copy link
Author

ROT13 variation for Georgian Alphabet.

ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is a special case of the Caesar cipher, developed in ancient Rome. Wikipedia

Actually, in Georgian alphabet there are 33 letters, so I had to add an old letter 'ჱ' (which is not in common use by now) and rotate it by 17 places.

Usage

'აბგდ'.rot17(); // 'სტუფ'
'სტუფ'.rot17(); // 'აბგდ'

More examples

'ვაშლი'.rot17(); // 'ღსთძჩ'
'უხუხ'.rot17(); // 'გოგო'
'ქუჩა'.rot17(); // 'ეგის'

For live example see fiddle

@nodech
Copy link

nodech commented Mar 29, 2015

ბარემ პირდაპირ ცეზარი დაგეწერა :D

@nikoloza
Copy link
Author

ცეზარი რაარი?

@IrakliJani
Copy link

@nikoloza
Copy link
Author

@nodar magashic gamodgeba :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment