#hex-string #sha-256 #algorithm #hash #optional #bishop #drunken

drunkenbishop

Implementation of the drunken bishop algorithm, with optional hex string parsing and SHA-256 pre-processing

2 releases

0.1.1 Apr 12, 2023
0.1.0 Apr 12, 2023

#25 in #hex-string

37 downloads per month

MIT license

9KB
129 lines

drunkenbishop

Rust library for the "drunken bishop" algorithm, which renders a series of bytes into an ASCII image.


lib.rs:

Library implementing the "drunken bishop" algorithm, popularly used in the OpenSSH "randomart" key visualization feature.

Special thanks to the paper "The drunken bishop: An analysis of the OpenSSH fingerprint visualization algorithm" by Dirk Loss, Tobias Limmer, and Alexander von Gernler.

The board size is locked to a 17 by 9 grid, to match the OpenSSH implementation. Unlike the original implementation however, no ASCII border will be drawn around the output.

This crate includes optional features that are not enabled by default:

  • hexparse - introduces a new function that accepts a hexadecimal string, and parses it into bytes, before rendering.
  • hash - introduces a new function that accepts any arbitrary string, and hashes it with SHA-256, before rendering.

Dependencies

~0.3–0.9MB
~21K SLoC