tripcode

A library for generating tripcodes on imageboards and textboards.


Keywords
tripcode, 4chan, 2channel, imageboard, textboard
Licenses
MIT/Apache-2.0

Documentation

Tripcode

Build Status Current Version

Documentation

README日本語版

A Rust library for generating tripcodes on imageboards and textboards.

Compatibility

This crate is compatible with tripcodes of the following formats:

  • 4chan's normal (non-secure) tripcode
  • 2channel's tripcodes:
    • 10-character tripcode (10桁トリップ)
    • Nama key tripcode (生キートリップ)
    • 12-character tripcode (12桁トリップ)
  • 2ch.sc's tripcodes:
    • 15-character tripcode (15桁トリップ)
    • Katakana tripcode (カタカナトリップ)

Usage

To use this crate, add the following to your project's Cargo.toml:

[dependencies]
tripcode = "0.2"

and this to your crate root:

extern crate tripcode;

Examples

use tripcode::*;

let mut tripcode;

// 4chan's tripcode.
tripcode = Fourchan::generate(&"password");
assert_eq!("ozOtJW9BFA", &tripcode);

// 2channel (Monazilla)'s tripcode. This function automatically selects the proper hashing algorithm.
tripcode = Mona::generate(&"7 bytes");
assert_eq!("W/RvZlE2K.", &tripcode);
tripcode = Mona::generate(&"twelve bytes");
assert_eq!("t+lnR7LBqNQY", &tripcode);
tripcode = Mona::generate(&"#1145145554560721..");
assert_eq!("14cvFmVHg2", &tripcode);

// 2channel's 10-character tripcode (10桁トリップ).
tripcode = Mona10::generate(&"password longer than 12 bytes");
assert_eq!("ozOtJW9BFA", &tripcode);

// 2channel's nama key tripcode (生キートリップ).
// This generator is failable so we use `try_generate()` method, which yields an `Option<String>`.
tripcode = MonaRaw::try_generate(&"#0123456789ABCDEF./").unwrap();
assert_eq!(&"IP9Lda5FPc", &tripcode);

// 2channel's 12-character tripcode (12桁トリップ).
tripcode = Mona12::generate(&"<12 bytes");
assert_eq!("/9L00Vb1PBcb", &tripcode);

tripcode command

This crate also provides a simple command line utility for generating tripcodes.

To install the command, run this in your shell:

cargo install tripcode

The command can take passwords either from arguments:

$ tripcode a b c
ZnBI2EKkq.
taAZ7oPCCM
wG1CV58ydQ

or from stdin (separated by newlines):

$ echo -e 'd\ne\nf' | tripcode -f
taZqHR8ods
xKvzozvsSk
bb6OCCHf8E

The command works with non-UTF-8 encodings as well:

$ echo トリップ | iconv -t sjis | tripcode -f
XSSH/ryx32

The command defaults to generate 4chan's tripcodes. You can generate 2channel's tripcodes by using --type=2ch option.