Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Oct 3, 2024
1 parent e7341dc commit ba658d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,25 @@ jobs:
name: OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}} / OS ${{matrix.os}}
strategy:
matrix:
os: ['ubuntu-22.04']
otp: ['26.1', '25.3', '24.3']
rebar3: ['3.22.1']
os: ['ubuntu-24.04']
otp: ['27', '26', '25']
rebar3: ['3.24.0']
include:
- otp: '26.1'
- otp: '23'
rebar3: '3.22.1'
os: 'windows-2022'
- otp: '26.1'
os: 'ubuntu-20.04'
- otp: '24'
rebar3: '3.22.1'
os: 'ubuntu-22.04'
- otp: '27'
rebar3: '3.24.0'
os: 'windows-2022'
- otp: '27'
rebar3: '3.24.0'
os: 'macos-latest'
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# OS setups
- name: Ubuntu/Windows – Prepare Erlang
Expand Down Expand Up @@ -71,27 +77,27 @@ jobs:
- run: rebar3 as test compile
- run: rebar3 as test ct
- run: rebar3 dialyzer
if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }}
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.04' }}
- name: Run coverage
if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }}
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.04' }}
run: |
rebar3 as test codecov analyze
gcov -o c_src fast_pbkdf2
- name: Upload coverage
if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }}
run: |
pip install --user codecov
/home/runner/.local/bin/codecov
- name: Upload coverage reports to Codecov
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.04' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-on-s390x:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup emulator
run: |
sudo docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0
- name: Run build
uses: uraimo/run-on-arch-action@v2.6.0
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: s390x
distro: ubuntu22.04
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{proper, "1.4.0"}
]},
{plugins, [
{rebar3_codecov, "0.6.0"}]},
{rebar3_codecov, "0.7.0"}]},
{port_env,
[
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
Expand Down
6 changes: 2 additions & 4 deletions src/fast_pbkdf2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
-export([pbkdf2/4, pbkdf2/5]).

%%% @doc
%%% This function calculates the pbkdf2 algorithm where dkLen is simply assumed to be that of the
%%% underlying hash function, a sane default.
%%% @end
%%% This function calculates the pbkdf2 algorithm where dkLen is simply assumed to be that
%%% of the underlying hash function, a sane default.
-spec pbkdf2(sha_type(), binary(), binary(), non_neg_integer()) -> binary().
pbkdf2(Hash, Password, Salt, IterationCount) ->
pbkdf2_block(Hash, Password, Salt, IterationCount, 1).

%%% @doc
%%% This function allows to customise the desired dkLen parameter for pbkdf2.
%%% @end
-spec pbkdf2(sha_type(), binary(), binary(), non_neg_integer(), non_neg_integer()) -> binary().
pbkdf2(Hash, Password, Salt, IterationCount, DkLen) ->
pbkdf2(Hash, Password, Salt, IterationCount, DkLen, 1, [], 0).
Expand Down

0 comments on commit ba658d2

Please sign in to comment.