Adds several helper hash functions
This commit is contained in:
parent
f14a10a381
commit
b2f12eae15
2 changed files with 37 additions and 2 deletions
35
lib/utils/Hashing.dart
Normal file
35
lib/utils/Hashing.dart
Normal file
|
@ -0,0 +1,35 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
class Hashing {
|
||||
static String md5Hash(String input) {
|
||||
var hash = md5.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static String sha1Hash(String input) {
|
||||
var hash = sha1.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static String sha256Hash(String input) {
|
||||
var hash = sha256.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
name: libac_flutter
|
||||
description: "Aria's Creations code library"
|
||||
version: 1.0.1
|
||||
homepage:
|
||||
version: 1.0.2
|
||||
homepage: "https://zontreck.com"
|
||||
|
||||
environment:
|
||||
sdk: '>=3.3.4 <4.0.0'
|
||||
|
|
Loading…
Reference in a new issue