Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deatil/zig-md2

A MD2 hash function library for Zig
https://github.com/deatil/zig-md2

md2 zig zig-md2

Last synced: about 1 month ago
JSON representation

A MD2 hash function library for Zig

Awesome Lists containing this project

README

        

## Zig-MD2

zig-md2 is a MD2 hash function for Zig.

### Env

- Zig >= 0.13

### Adding zig-md2 as a dependency

Add the dependency to your project:

```sh
zig fetch --save=zig-md2 git+https://github.com/deatil/zig-md2#main
```

And the following to your `build.zig` file:

```zig
const zig_md2 = b.dependency("zig-md2", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zig-md2", zig_md2.module("zig-md2"));
exe.linkLibrary(zig_md2.artifact("zig-md2"));
```

The `zig-md2` structure can be imported in your application with:

```zig
const zig_md2 = @import("zig-md2");
```

### Get Starting

~~~zig
const std = @import("std");
const MD2 = @import("zig-md2").MD2;

pub fn main() !void {
var out: [16]u8 = undefined;

h = MD2.init(.{});
h.update("abc");
h.final(out[0..]);

// output: da853b0d3f88d99b30283a69e6ded6bb
std.debug.print("output: {s}\n", .{out});
}
~~~

### LICENSE

* The library LICENSE is `Apache2`, using the library need keep the LICENSE.

### Copyright

* Copyright deatil(https://github.com/deatil).