login about faq

Hi, I'm using CkCrypt2's genEncodedSecretKey() function to generate a const char* (or const wchar_t* in unicode) secret key. The documentation tells me the function returns:

...a string encoded according to encoding, which may be "base64", "hex", "url", etc.

What it doesn't say is what the "etc" covers - what other encodings are allowed? If I specify "ascii", for instance, it returns what looks like an ascii string, but it is not a consistent length (I'd expect 32 chars for a 256 bit key length): the length can be anything from 1 to 32 chars before a null terminator is found.

Is there a list of exactly which encodings can be used for this function? I ideally want to get back an ascii encoded string, 32 chars in length...

asked Feb 01 '13 at 04:32

njshaw2's gravatar image

njshaw2
6223


The list of encoding algorithms is the same as those listed for the CkCrypt2's EncodingMode property, which is "Base64", "modBase64", "Base32", "UU", "QP" (for quoted-printable), "URL" (for url-encoding), "Hex", "Q", "B", "url_oath", "url_rfc1738", "url_rfc2396", and "url_rfc3986".

In general, wherever an encoding string argument is specified, then any of these encodings can be used. If/when Chilkat adds a new encoding implementation to the API, it will automatically be available across-the-board in all API's that might have a method argument or property that specifies encoding.

PS> Don't confuse this kind of encoding with character encoding, which is a different subject. Character encodings, also known as charset's or code-pages, are things such as "utf-8", "iso-8859-1", "utf-16", "us-ascii", "ebcdic", etc.

link

answered Feb 01 '13 at 17:11

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks, that's what I needed to know. And you're right - I was getting confused between character encoding and data encoding.

(Feb 04 '13 at 04:08) njshaw2
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:

×8

Asked: Feb 01 '13 at 04:32

Seen: 1,702 times

Last updated: Feb 04 '13 at 04:08

powered by OSQA