Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timmarinin/pgp-words
https://github.com/timmarinin/pgp-words
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/timmarinin/pgp-words
- Owner: timmarinin
- Created: 2018-06-20T14:34:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-27T21:12:28.000Z (over 6 years ago)
- Last Synced: 2024-04-24T14:30:11.000Z (7 months ago)
- Language: Rust
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pgp-words
Crate for transforming bytes (`u8`) into [PGP words](https://en.wikipedia.org/wiki/PGP_word_list) and back.
Status: functions `to_bytes` and `to_words` are working, but need documentation.
```rust
extern crate pgp_words;fn main() {
let msg: [u8; 4] = [0x2D, 0x6D, 0xED, 0x27];
let words = pgp_words::to_words(&msg);
assert_eq!(words[0], "button");
assert_eq!(words[1], "hazardous");
assert_eq!(words[2], "tunnel");
assert_eq!(words[3], "celebrate");
}
````to_bytes` returns `Option>`, because you can pass words that are not part of the list or that have the wrong evenness, there are no attempts to recover and `pgp_words` would return `None`.
## License
`pgp-words` is MIT licensed. 2018, Tim Marinin
Words were taken from the Wikipedia entry on 2018-06-20.