This commit is contained in:
krasnovats 2025-12-01 11:29:54 +03:00
commit 520856d083
3 changed files with 29 additions and 0 deletions

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module bcrypt-geneator
go 1.24.10
require golang.org/x/crypto v0.45.0 // indirect

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=

22
main.go Normal file
View File

@ -0,0 +1,22 @@
package main
import (
"fmt"
"golang.org/x/crypto/bcrypt"
)
func main() {
// Пароль, который хотим захешировать
password := "Tatyana1"
// Генерация хеша
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
fmt.Println("Ошибка генерации хеша:", err)
return
}
// Выводим хеш
fmt.Println("Пароль:", password)
fmt.Println("Хеш bcrypt:", string(hash))
}