This repository has been archived on 2025-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
vikunja/pkg/utils/sha256.go
konrad 3f44e3b83e
All checks were successful
the build was successful
Change License to GPLv3 (#26)
2018-11-26 20:17:33 +00:00

28 lines
997 B
Go

// Vikunja is a todo-list application to facilitate your life.
// Copyright 2018 Vikunja and contributors. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package utils
import (
"crypto/sha256"
"fmt"
)
// Sha256 calculates a sha256 hash from a string
func Sha256(cleartext string) string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(cleartext)))[:45]
}