mirror of
https://github.com/clearlinux/clr-installer.git
synced 2026-09-02 19:51:30 +00:00
We make sure multiple calls to crypt return different hashes. Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
28 lines
458 B
Go
28 lines
458 B
Go
// Copyright © 2018 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
package crypt
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestCrypt(t *testing.T) {
|
|
str := "a string to be hashed"
|
|
|
|
hashed, err := Crypt(str)
|
|
if err != nil {
|
|
t.Fatalf("Should not fail to hash the string")
|
|
}
|
|
|
|
hashed2, err := Crypt(str)
|
|
if err != nil {
|
|
t.Fatalf("Should not fail to hash the string")
|
|
}
|
|
|
|
if hashed2 == hashed {
|
|
t.Fatalf("The hashes should not be the same")
|
|
}
|
|
}
|