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


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


answered Feb 26 '14 at 09:30

chilkat's gravatar image

chilkat ♦♦

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?


answered Feb 26 '14 at 09:47

chilkat's gravatar image

chilkat ♦♦

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"...


answered Feb 26 '14 at 10:11

Marco's gravatar image


Are there any news? Could you reproduce this problem?


answered Mar 13 '14 at 16:57

Marco's gravatar image


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



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



Asked: Feb 26 '14 at 09:23

Seen: 4,694 times

Last updated: Mar 14 '14 at 11:18

powered by OSQA