Add redundancy to PacketServer

This commit is contained in:
zontreck 2024-08-29 07:56:42 -07:00
parent 7bcb3a755a
commit c6b8eec4ed
4 changed files with 147 additions and 55 deletions

View file

@ -5,17 +5,17 @@ import 'package:crypto/crypto.dart';
class Hashing {
/// This will generate the md5 bytes and hash it using #bytes2Hash
static String md5Hash(String input) {
return bytes2Hash(md5Sum(input));
return bytes2Hash(md5SumStr(input));
}
/// This will generate the Sha1 bytes and hash it using #bytes2Hash
static String sha1Hash(String input) {
return bytes2Hash(sha1Sum(input));
return bytes2Hash(sha1SumStr(input));
}
/// This will generate the Sha256 bytes and hash it using #bytes2Hash.
static String sha256Hash(String input) {
return bytes2Hash(sha256Sum(input));
return bytes2Hash(sha256SumStr(input));
}
/// This function takes a list of bytes and returns a hash string
@ -29,17 +29,32 @@ class Hashing {
}
/// This function returns the bytes instead of a hash string
static List<int> md5Sum(String input) {
static List<int> md5SumStr(String input) {
return md5.convert(utf8.encode(input)).bytes;
}
/// This functions returns the bytes instead of a hash string
static List<int> sha1Sum(String input) {
static List<int> sha1SumStr(String input) {
return sha1.convert(utf8.encode(input)).bytes;
}
/// This function returns the bytes instead of a hash string
static List<int> sha256Sum(String input) {
static List<int> sha256SumStr(String input) {
return sha256.convert(utf8.encode(input)).bytes;
}
/// This function returns the bytes instead of a hash string
static List<int> md5Sum(List<int> input) {
return md5.convert(input).bytes;
}
/// This functions returns the bytes instead of a hash string
static List<int> sha1Sum(List<int> input) {
return sha1.convert(input).bytes;
}
/// This function returns the bytes instead of a hash string
static List<int> sha256Sum(List<int> input) {
return sha256.convert(input).bytes;
}
}