Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/alexandrevicenzi/unchained
Secure password hashers for Go compatible with Django Password Hashers.
Unchained can also be used to perform password validation against legacy or shared Django databases.
Requires Go 1.9 or higher.
go get github.com/alexandrevicenzi/unchained
Hasher | Encode | Decode | Dependencies |
---|---|---|---|
Argon2 | ✔ | ✔ | golang.org/x/crypto/argon2 |
BCrypt | ✔ | ✔ | golang.org/x/crypto/bcrypt |
BCrypt SHA256 | ✔ | ✔ | golang.org/x/crypto/bcrypt |
Crypt | ✘ | ✘ | |
MD5 | ✔ | ✔ | |
PBKDF2 SHA1 | ✔ | ✔ | golang.org/x/crypto/pbkdf2 |
PBKDF2 SHA256 | ✔ | ✔ | golang.org/x/crypto/pbkdf2 |
SHA1 | ✔ | ✔ | |
Unsalted MD5 | ✔ | ✔ | |
Unsalted SHA1 | ✔ | ✔ |
Crypt support is not planned because it's UNIX only.
BCrypt hasher does not allow to set custom salt as in Django. If you encode the same password multiple times you will get different hashes. This limitation comes from golang.org/x/crypto/bcrypt library.
package main
import "github.com/alexandrevicenzi/unchained"
func main() {
hash, err := unchained.MakePassword("my-password", unchained.GetRandomString(12), "default")
if err == nil {
fmt.Println(hash)
} else {
fmt.Printf("Error encoding password: %s\n", err)
}
}
package main
import "github.com/alexandrevicenzi/unchained"
func main() {
valid, err := unchained.CheckPassword("admin", "pbkdf2_sha256$24000$JMO9TJawIXB1$5iz40fwwc+QW6lZY+TuNciua3YVMV3GXdgkhXrcvWag=")
if valid {
fmt.Println("Password is valid.")
} else {
if err == nil {
fmt.Println("Password is invalid.")
} else {
fmt.Printf("Error decoding password: %s\n", err)
}
}
}
BSD
django.core.signing
)FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.