// Copyright 2024 Patial Tech (Ankit Patial). // // This file is part of code.patial.tech/go/appcore, which is MIT licensed. // See http://opensource.org/licenses/MIT package crypto import ( "crypto/md5" "crypto/sha256" "encoding/hex" ) // MD5 is generally faster to compute than SHA-256 func MD5(b []byte) string { hash := md5.Sum(b) return hex.EncodeToString(hash[:]) } // SHA256 Sum256 is generally preferred over md5.hash due to its superior security and resistance to collision attacks func SHA256(b []byte) string { hash := sha256.Sum256(b) return hex.EncodeToString(hash[:]) }