jwerle / pretty-hash.c

A C implementation of pfrazee's pretty-hash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pretty-hash.c

A C implementation of pfrazee's pretty-hash

Installation

$ clib install jwerle/pretty-hash.c --save

Usage

#include <pretty-hash/pretty-hash.h>

int
main(void) {
  unsigned char bytes[] = {
    0x00, 0x11, 0x22, 0x33,
    0x44, 0x55, 0x66, 0x77,
    0x88, 0x99, 0xaa, 0xbb,
    0xcc, 0xdd, 0xee, 0xee
  };

  char hash[pretty_hash_BYTES] = { 0 };
  int size = pretty_hash(hash, bytes, sizeof(bytes));
  printf("%s\n", hash);
  return 0;
}

Usage as a clib Module

As a clib module:

#include <pretty-hash/module.h>

int
main(void) {
  module(pretty_hash) *pretty = require(pretty_hash);
  unsigned char bytes[] = {
    0x00, 0x11, 0x22, 0x33,
    0x44, 0x55, 0x66, 0x77,
    0x88, 0x99, 0xaa, 0xbb,
    0xcc, 0xdd, 0xee, 0xee
  };

  char hash[pretty_hash_BYTES] = { 0 };
  int size = pretty->hash(hash, bytes, sizeof(bytes));
  printf("%s\n", hash);
  return 0;
}

See Also

License

MIT

About

A C implementation of pfrazee's pretty-hash

License:MIT License


Languages

Language:C 84.9%Language:JavaScript 10.3%Language:Makefile 4.9%