login about faq

I'm trying to use CkCrypt2 Pbkdf2 function with HMAC-SHA256. In your documentation I find: "The hashAlg may be "md5", "sha1", "md2", etc." - So I used "sha256". But

Pbkdf2((char*)&plain[0], "ANSI", "sha256", _salt, iterations, keylen, "hex", out);

returns true, but out is empty. Using "sha1" it returns a result. Is "sha256" valid and implemented?

asked Feb 26 '14 at 09:23

Marco's gravatar image

Marco
6346


It should be valid. I'll give it a quick test to verify..

link

answered Feb 26 '14 at 09:30

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

It worked fine for me. Please provide the exact inputs for each arg so I can duplicate exactly what you did. Also, what programming language, operating system, .NET Framework, Visual Studio version, architecture, Perl version, Python version, etc. would you need for a new build, just in case it works for me with the same inputs?

link

answered Feb 26 '14 at 09:47

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanx A LOT for your fast investigation!

I'm using the latest C++ library v9.4.1SP1 under VS2013

plain is: "password", salt is "salt", iterations is: 4096, keylen is: 256

Code is:

const char* _salt = lib.encodeBytes(&salt[0], salt.size(), "hex");
CkString out;
bool res = lib.Pbkdf2((char*)&plain[0], "ANSI", "sha256", _salt, iterations, keylen, "hex", out);
const char* c = out.getAnsi();

res is true, but c is empty.

As I said, with "sha1" c has a valid result.

Strange: When I set (wrong) "sha2", result is SAME as with "sha1"...

link

answered Feb 26 '14 at 10:11

Marco's gravatar image

Marco
6346

Are there any news? Could you reproduce this problem?

link

answered Mar 13 '14 at 16:57

Marco's gravatar image

Marco
6346

I found the problem. I'll post a link to a new build ASAP..

(Mar 14 '14 at 10:26) chilkat ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×1

Asked: Feb 26 '14 at 09:23

Seen: 2,802 times

Last updated: Mar 14 '14 at 11:18

powered by OSQA