myph.git


myph

~ shellcode loader for your evasion needs
git clone https://github.com/matro7sh/myph.git
log | files | refs | archive | README | LICENSE

hashes.go (728B)

      1 package internals
      2 
      3 import (
      4 	"crypto/sha1"
      5 	"crypto/sha256"
      6 	"crypto/sha512"
      7 	"fmt"
      8 )
      9 
     10 /*
     11    holds the different hashing algorithms available for this loader
     12 */
     13 
     14 func HashSHA1(toHash string) string {
     15 	h := sha1.New()
     16 	h.Write([]byte(toHash))
     17 	bs := h.Sum(nil)
     18 
     19 	return fmt.Sprintf("%x", bs)
     20 }
     21 
     22 func HashSHA256(toHash string) string {
     23 	h := sha256.New()
     24 	h.Write([]byte(toHash))
     25 	bs := h.Sum(nil)
     26 
     27 	return fmt.Sprintf("%x", bs)
     28 }
     29 
     30 func HashSHA512(toHash string) string {
     31 	h := sha512.New()
     32 	h.Write([]byte(toHash))
     33 	bs := h.Sum(nil)
     34 
     35 	return fmt.Sprintf("%x", bs)
     36 }
     37 
     38 func HashDJB2(input string) string {
     39 	hash := uint64(5381)
     40 
     41 	for _, b := range input {
     42 		hash += uint64(b) + hash + hash<<5
     43 	}
     44 
     45 	return fmt.Sprintf("%x", hash)
     46 }