Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deatil/zig-sm3
A SM3 hash function for Zig
https://github.com/deatil/zig-sm3
sm3 zig zig-sm3
Last synced: 8 days ago
JSON representation
A SM3 hash function for Zig
- Host: GitHub
- URL: https://github.com/deatil/zig-sm3
- Owner: deatil
- License: apache-2.0
- Created: 2024-07-25T03:20:24.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-26T17:00:43.000Z (4 months ago)
- Last Synced: 2024-11-11T20:26:27.841Z (2 months ago)
- Topics: sm3, zig, zig-sm3
- Language: Zig
- Homepage: https://github.com/deatil/zig-sm3
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Zig-SM3
zig-sm3 is a SM3 hash function for Zig.
### Env
- Zig >= 0.13
### Adding zig-sm3 as a dependency
Add the dependency to your project:
```sh
zig fetch --save=zig-sm3 git+https://github.com/deatil/zig-sm3#main
```And the following to your `build.zig` file:
```zig
const zig_sm3 = b.dependency("zig-sm3", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zig-sm3", zig_sm3.module("zig-sm3"));
exe.linkLibrary(zig_sm3.artifact("zig-sm3"));
```The `zig-sm3` structure can be imported in your application with:
```zig
const zig_sm3 = @import("zig-sm3");
```### Get Starting
~~~zig
const std = @import("std");
const SM3 = @import("zig-sm3").SM3;pub fn main() !void {
var out: [32]u8 = undefined;
h = SM3.init(.{});
h.update("abc");
h.final(out[0..]);
// output: 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0
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).