GithubHelp home page GithubHelp logo

fastpbkdf2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastpbkdf2's Issues

Cut a release for fastpbkdf2

Hey, do you mind tagging a release whenever there are any useful updates to fastpbkdf2? Would make it easier for me to know when I need to cut a new release for the Python bindings.

build errors: "undefined reference to" in fastpbkdf2.c

/home/banana/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/212.5656.12/bin/cmake/linux/bin/cmake --build /home/banana/CLionProjects/untitled4/lib/cmake -build-debug --target libexe -j 9 [4/4] Linking C executable libexe FAILED: libexe : && /usr/bin/cc -g CMakeFiles/libexe.dir/fastpbkdf2.c.o CMakeFiles/libexe.dir/myFs.c.o CMakeFiles/libexe.dir/main.c.o -o libexe && : /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha1_init" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Final" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha1_update" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha1_final" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Final" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Final" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "pbkdf2_f_sha1" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Transform" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:271: undefined reference to "SHA1_Transform" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha256_init" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Final" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha256_update" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha256_final" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Final" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Final" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "pbkdf2_f_sha256" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Transform" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:319: undefined reference to "SHA256_Transform" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha512_init" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Final" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Update" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Init" /usr/bin/ld: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha512_update" function: /home/banana/CLionProjects/untitled4/lib/fastpbkdf2.c:367: undefined reference to "SHA512_Update" /usr/bin/ld: CMakeFiles/libexe.dir/fastpbkdf2.c.o: in "HMAC_sha512_final" function: /home/banana/CLionPr

CMakeLists.txt:
`cmake_minimum_required(VERSION 3.22)
project(libexe)

set(CMAKE_C_STANDARD 99)

file(GLOB SOURCE
fastpbkdf2.h
fastpbkdf2.c
myFs.h
myFs.c
main.c
)

add_executable(libexe ${SOURCE} )`

I use linux, IDE: CLion, Cmake: Bundled, Generator: Ninja (and others also tried, no change).

what i do wrong?

i need to use this library in my CMakeLists project on linux

Illegal instruction error

Hi,

Upon compilation, I am unable to run the tests or use the provided optimised functions:

(gdb) run
Starting program: /opt/fastpbkdf2/testfastpbkdf2 
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=9fdc592b21682a31f460f6f043f50eea8c8b6821"
Missing separate debuginfo for /usr/lib64/libcrypto.so.0.9.8
Try: zypper install -C "debuginfo(build-id)=fffc0c11598c39d127411fe36ba1d2777c0ee1d0"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=e2cab3c95cb1189420734b4af264b047355be2e5"
Missing separate debuginfo for /lib64/libdl.so.2
Try: zypper install -C "debuginfo(build-id)=732292820e69f70459cb927ade5b49bc56d32b0f"
Missing separate debuginfo for /lib64/libz.so.1
Try: zypper install -C "debuginfo(build-id)=c96d4398cb0a4f35e94ce172f9536cd5ebd20dd6"
Missing separate debuginfo for /lib64/libpthread.so.0
Try: zypper install -C "debuginfo(build-id)=48172710254f4e2549684d7d3e9f9622272d6c66"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
sha1 (6 tests):

Program received signal SIGILL, Illegal instruction.
0x0000000000401a9e in HMAC_sha1_init (nkey=<optimized out>, key=<optimized out>, ctx=0x7fffffff89c0) at fastpbkdf2.c:268
268	DECL_PBKDF2(sha1,

What could be wrong?

SHA224 and SHA384 Support?

I've tried this:

DECL_PBKDF2(sha224,
            SHA256_CBLOCK,
            SHA224_DIGEST_LENGTH,
            SHA256_CTX,
            SHA224_Init,
            SHA224_Update,
            SHA256_Transform,
            SHA224_Final,
            sha256_cpy,
            sha256_extract,
            sha256_xor)

But it doesn't seem to cut it. Any advise?

result hmac_sha512 differs from Perl's

Hi there and thank you for this free implementation.

I can not produce the same result using your library's fastpbkdf2_hmac_sha512() with Perl's Digest::SHA::hmac_sha512 and also Python's hashlib.sha512 (Perl's and Python's output do agree).

The problem may well be with me misunderstanding the usage of fastpbkdf2_hmac_sha512(). If this is the case, apologies in advance and please let me know how to use said function with a message and a secret key (no salt - are they the same?) and no repetitions.

Here are 2 programs to reproduce my problem:

test.c:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fastpbkdf2.h"

// gcc -g test.c libfastpbkdf2.a -lcrypto && a.out
// this is not producing the right result compared to perl

#define SHA512_DIGEST_SIZE (512/8)

// print binary buffer in hex
void printhex(FILE *fh, const char *name, const unsigned char *in, int len){
	fprintf(fh, "begin hex for '%s':\n", name);
	for(int i=0;i<len;i++){ fprintf(fh, "0x%02x ", in[i]); }
	fprintf(fh, "\nend hex of %d bytes.\n", len);
}

int main(void){
	char *message = "hello there";
	char *key = "secret key";
	char result[SHA512_DIGEST_SIZE];
	int key_len = strlen(key);
	int message_len = strlen(message);

        fastpbkdf2_hmac_sha512(
                // this is the input and its size
                (uint8_t *)message, message_len,
                // salt to the hash is our secret key decoded
                (uint8_t *)key, key_len,
                1, // iterations
                // the output goes here
                result, SHA512_DIGEST_SIZE
        );

	printhex(stdout, "result", result, SHA512_DIGEST_SIZE);
}

and here is the Perl script which produces a different result but which agrees with Python and also with another C implementation (by ogay):

mac.pl (run it as perl mac.pl)

#!/usr/bin/env perl
use strict;
use warnings;
use Digest::SHA qw/hmac_sha512/;

my $message = "hello there";
my $secret = "secret key";
my $hmacsha512 = Digest::SHA::hmac_sha512($message, $secret);
print "result hmacsha512:\n".bin2hex($hmacsha512)."\n";

sub bin2hex {
	my @byts = split //, $_[0];
	join(' ', map {sprintf("0x%x", ord)} @byts) . " (size ".@byts.")";
}

I would really love to use your implementation but I need to solve this issue right now.

As I said, the problem may be with me using your function incorrectly. In this case please advise. My usage is that I have a message and a key. Is your salt the same as my key? and I don't need repetitions (what's the default?), so I set them to 1. Even 0 repetitions produce mismatched result.

5minute Edit: here are the 2 outputs:
test.c:

begin hex for 'result':
0x07 0x89 0xd9 0x61 0x75 0xc5 0x12 0x3f 0x05 0x80 0xcc 0xf8 0x2e 0x5b 0x9e 0xa2 0x3e 0x6c 0x84 0xb4 0xb7 0x47 0x84 0x98 0x26 0x6e 0xa1 0x46 0x2e 0x3d 0x6a 0x38 0xcf 0x89 0xda 0x15 0xa8 0x24 0x7e 0xab 0x1f 0xd0 0x49 0xcb 0x04 0xd5 0xd8 0x96 0x6c 0x89 0xfb 0x60 0x54 0x27 0xe8 0xf9 0xf0 0x97 0xd7 0xe1 0x1d 0x5b 0x7d 0x6f 
end hex of 64 bytes.

mac.pl:

result hmacsha512:
0x8c 0x66 0xa0 0x21 0x29 0x38 0xf9 0x80 0xcf 0x49 0x93 0x79 0xfb 0xcd 0xc1 0x8d 0xb7 0x16 0x0 0x55 0x3c 0x4e 0x62 0x57 0xe3 0x8f 0x96 0x41 0x79 0xf8 0xe5 0x67 0xb8 0xa2 0x2b 0x38 0xb0 0xdb 0x54 0xee 0xd8 0x1 0x6 0xdd 0xb0 0x38 0x4b 0xc3 0x3f 0x20 0xba 0xb7 0xdf 0xa2 0x99 0xc2 0x80 0x12 0x43 0x63 0x58 0x2 0x84 0x27
(size 64)

bw,
Andreas Hadjiprocopis

openssl 3

Any plan for an openssl 3.0 update?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.