Skip to content

Commit

Permalink
Update Strobe hash function and example message
Browse files Browse the repository at this point in the history
LICENSE update
README update
  • Loading branch information
justkawal committed Nov 10, 2023
1 parent 605b5c8 commit 3cdfd8e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (C) 2023 - Kawaljeet Singh

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import 'package:convert/convert.dart';
import 'package:strobe/strobe.dart';
void main() {
final Strobe s =
Strobe.initStrobe('AnyStrobeHash', Security.bit128);
final Strobe s = Strobe.initStrobe('custom_hash', Security.bit128);
final List<int> message = utf8.encode('Hello sir, How\'s your day going?');
final List<int> message =
utf8.encode('Hello, Drop a star if you like this repo!');
s.aD(false, message); // meta = false
// output length = 16
// c96ff4e5cb10c20168af74e25b3cd4d3
// output length = 16
// 7ce830010a697657a77b71efff657dd8
print(hex.encode(s.prf(16)));
}
```
11 changes: 7 additions & 4 deletions example/example.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'dart:convert';

import 'package:convert/convert.dart';
import 'package:strobe/strobe.dart';

void main() {
final Strobe s =
Strobe.initStrobe('AnyStrobeHash', Security.bit128); // 128-bit security
final List<int> message = utf8.encode('Hello sir, How\'s your day going?');
final Strobe s = Strobe.initStrobe('custom_hash', Security.bit128);

final List<int> message =
utf8.encode('Hello, Drop a star if you like this repo!');
s.aD(false, message); // meta = false

// output length = 16 // c96ff4e5cb10c20168af74e25b3cd4d3
// output length = 16
// 7ce830010a697657a77b71efff657dd8
print(hex.encode(s.prf(16)));
}
2 changes: 1 addition & 1 deletion lib/src/strobe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class Strobe {
for (int dataByte in data) {
failures |= dataByte;
}
return [failures]; // 0 if correct, 1 if not
return <int>[failures]; // 0 if correct, 1 if not
}

return [];
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: strobe
description: Strobe
description: Strobe contains implementation of the [Strobe protocol framework](https://strobe.sourceforge.io/).
version: 1.0.1
repository: https://github.com/justkawal/strobe

Expand Down

0 comments on commit 3cdfd8e

Please sign in to comment.