From 3cdfd8e4e7c47797f37fe3e30844ca912470fc11 Mon Sep 17 00:00:00 2001 From: Kawaljeet Singh Date: Thu, 9 Nov 2023 22:57:24 -0500 Subject: [PATCH] Update Strobe hash function and example message LICENSE update README update --- LICENSE | 20 ++++++++++++++++++++ README.md | 10 +++++----- example/example.dart | 11 +++++++---- lib/src/strobe.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..aa4c0a4 --- /dev/null +++ b/LICENSE @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 44d0e57..98d3c93 100644 --- a/README.md +++ b/README.md @@ -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 message = utf8.encode('Hello sir, How\'s your day going?'); + final List 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))); } ``` \ No newline at end of file diff --git a/example/example.dart b/example/example.dart index 30b46a8..decdecd 100644 --- a/example/example.dart +++ b/example/example.dart @@ -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 message = utf8.encode('Hello sir, How\'s your day going?'); + final Strobe s = Strobe.initStrobe('custom_hash', Security.bit128); + + final List 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))); } diff --git a/lib/src/strobe.dart b/lib/src/strobe.dart index 2be0ab0..cf4e91b 100644 --- a/lib/src/strobe.dart +++ b/lib/src/strobe.dart @@ -487,7 +487,7 @@ class Strobe { for (int dataByte in data) { failures |= dataByte; } - return [failures]; // 0 if correct, 1 if not + return [failures]; // 0 if correct, 1 if not } return []; diff --git a/pubspec.yaml b/pubspec.yaml index 3708698..d75cdce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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