-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
211 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# GitHub Code Owners | ||
# More info about this file can be found in the GitHub documentation: | ||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax | ||
|
||
# Default reviewers for all files | ||
* @matthewhartstonge | ||
|
||
# Request a review from devops team members for github related changes. | ||
.github/ @matthewhartstonge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: go | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Download Go Modules | ||
run: go mod download | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/[email protected] | ||
|
||
test: | ||
name: Test Go@v${{ matrix.go-version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: | ||
- '1.11.4' | ||
- '1.12' | ||
- '1.13' | ||
- '1.14' | ||
- '1.15' | ||
- '1.16' | ||
- '1.17' | ||
- '1.18' | ||
- '1.19' | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Download Go Modules | ||
run: go mod download | ||
|
||
- name: Run Tests | ||
run: go test ./... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
## [v0.3.0] - 2022-11-05 | ||
### Added | ||
- .github: adds support for github actions, codeowners and dependabot. | ||
|
||
### Changed | ||
- deps: updates to `[email protected]` and `golang.org/x/[email protected]`. | ||
- readme: update badges and remove references to travis ci. | ||
- *: update project licensing. | ||
|
||
### Fixed | ||
- argon2: fixes grammar and comment line length. | ||
|
||
### Removed | ||
- dep: removes support for dep. | ||
- travis: removes travis configuration. | ||
|
||
## [v0.2.1] - 2022-02-22 | ||
GPG signed release. | ||
|
||
|
@@ -83,6 +99,7 @@ GPG signed release. | |
- readme: Fix example link | ||
|
||
[Unreleased]: https://github.com/matthewhartstonge/argon2/tree/master | ||
[v0.3.0]: https://github.com/matthewhartstonge/argon2/tree/v0.3.0 | ||
[v0.2.1]: https://github.com/matthewhartstonge/argon2/tree/v0.2.1 | ||
[v0.2.0]: https://github.com/matthewhartstonge/argon2/tree/v0.2.0 | ||
[v0.1.5]: https://github.com/matthewhartstonge/argon2/tree/v0.1.5 | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2022. Matthew Hartstonge <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2022. Matthew Hartstonge <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// Package argon2 implements the key derivation function Argon2. | ||
// | ||
// Argon2 was selected as the winner of the Password Hashing Competition and | ||
|
@@ -168,7 +184,8 @@ func MemoryConstrainedDefaults() Config { | |
|
||
// Hash takes a password and optionally a salt and returns an Argon2 hash. | ||
// | ||
// If salt is nil a appropriate salt of Config.SaltLength bytes is generated for you. | ||
// If salt is nil an appropriate salt of Config.SaltLength bytes is generated | ||
// for you. | ||
func (c *Config) Hash(pwd []byte, salt []byte) (Raw, error) { | ||
if pwd == nil { | ||
return Raw{}, ErrPwdTooShort | ||
|
@@ -214,7 +231,8 @@ func (c *Config) HashEncoded(pwd []byte) (encoded []byte, err error) { | |
return | ||
} | ||
|
||
// Raw wraps a salt and hash pair including the Config with which it was generated. | ||
// Raw wraps a salt and hash pair including the Config with which it was | ||
// generated. | ||
// | ||
// A Raw struct is generated using Decode() or the Hash*() methods above. | ||
// | ||
|
@@ -239,7 +257,8 @@ func (raw *Raw) Verify(pwd []byte) (bool, error) { | |
return subtle.ConstantTimeCompare(r.Hash, raw.Hash) == 1, nil | ||
} | ||
|
||
// VerifyEncoded returns true if `pwd` matches the encoded hash `encoded` and otherwise false. | ||
// VerifyEncoded returns true if `pwd` matches the encoded hash `encoded` and | ||
// otherwise false. | ||
func VerifyEncoded(pwd []byte, encoded []byte) (bool, error) { | ||
r, err := Decode(encoded) | ||
if err != nil { | ||
|
@@ -249,7 +268,7 @@ func VerifyEncoded(pwd []byte, encoded []byte) (bool, error) { | |
} | ||
|
||
// SecureZeroMemory is a helper method which sets all bytes in `b` | ||
// (up to it's capacity) to `0x00`, erasing it's contents. | ||
// (up to its capacity) to `0x00`, erasing its contents. | ||
func SecureZeroMemory(b []byte) { | ||
b = b[:cap(b):cap(b)] | ||
for i := range b { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
// Copyright (c) 2016 Leonard Hecker | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
/* | ||
* Copyright 2022. Matthew Hartstonge <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package argon2_test | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
// Copyright (c) 2016 Leonard Hecker | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
/* | ||
* Copyright 2022. Matthew Hartstonge <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package argon2 | ||
|
||
|
@@ -175,7 +187,8 @@ var ( | |
encTypID = []byte("id$v=") | ||
) | ||
|
||
// Encode turns a Raw struct into the official stringified/encoded argon2 representation. | ||
// Encode turns a Raw struct into the official stringified/encoded argon2 | ||
// representation. | ||
// | ||
// The resulting byte slice can safely be turned into a string. | ||
func (raw *Raw) Encode() []byte { | ||
|
@@ -220,7 +233,8 @@ func (raw *Raw) Encode() []byte { | |
return buf | ||
} | ||
|
||
// Decode takes a stringified/encoded argon2 hash and turns it back into a Raw struct. | ||
// Decode takes a stringified/encoded argon2 hash and turns it back into a Raw | ||
// struct. | ||
// | ||
// This decoder ignores "data" attributes as they are likely to be deprecated. | ||
func Decode(encoded []byte) (Raw, error) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2022. Matthew Hartstonge <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package argon2 | ||
|
||
import ( | ||
|
Oops, something went wrong.