Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

warrenguy/javascript-pgp-word-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

pgp-word-list.js

Convert hex strings to PGP word lists and vice-versa.

See PGP word list on WikiPedia for more information.

I've also written a Ruby version: ruby-pgp-word-list.

Usage

Include pgp-word-list.js, which provides following functions:

> pgp_words_to_hex(["stairway", "souvenir", "flytrap", "recipe"])
=> ["D1", "D4", "64", "C0"]

> pgp_hex_to_words(["D1", "D4", "64", "C0"])
=> ["stairway", "souvenir", "flytrap", "recipe"]

also singular pgp_word_to_hex(word) and pgp_hex_to_word(hex, position).

More examples

> var hexstring = 'd1d4 64c0';
> pgp_hex_to_words(hexstring.toUpperCase().replace(/[^0-9A-F]/g,'').match(/.{1,2}/g))
=> ["stairway", "souvenir", "flytrap", "recipe"]

> var wordstring = 'stairway souvenir flytrap recipe';
> pgp_words_to_hex(wordstring.split(' '))
=> ["D1", "D4", "64", "C0"]

> pgp_words_to_hex(wordstring.split(' ')).join(' ')
=> "D1 D4 64 C0"

etc...

Author

Warren Guy warren@guy.net.au

https://warrenguy.me

The word list itself belongs to PGP Corporation.

License

MIT license. See LICENSE

About

Convert hex strings to PGP word lists and vice-versa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published