0

I'm trying to understand how the function encrypt works (linux), but event with this simple example is not working.
Any ideas?. Thank you.

#define _XOPEN_SOURCE

#include <unistd.h>
#include <stdlib.h>
#include <iostream>
#include <string>

int main()
{
    const char key[64] = "12" ;      /* bit pattern for key */
    char txt[64] = "test encrypt";      /* bit pattern for messages */

    // set Key
    setkey(key);

    // show original
    std::cout << "Original text : " << txt << std::endl;

    // encode
    encrypt(txt, 0);
    std::cout << "Encrypted : " << txt << std::endl;

    // decode
    encrypt(txt, 1);
    std::cout << "UnEncrypted : " << txt << std::endl;

    return 0;
}
2
Contributors
3
Replies
21
Views
2 Years
Discussion Span
Last Post by tinstaafl
0

According to the help file:

The block argument to encrypt() is an array of length 64 bytes containing only the bytes with numerical value of 0 and 1

0

ok, thank you good advise to review the api.

Edited by jBat: typo

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.