summaryrefslogtreecommitdiffstats
path: root/kshowmail/encryption.h
blob: 87811397f7440e61dfdeada62f7d34c7ec12270c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// C++ Interface: encryption
//
// Description:
//
//
// Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//

//TQt headers
#include <tqstring.h>

//KDE headers
#include <kurl.h>

/**
 * @brief Provides functions to crypt and decrypt a password.
 */
namespace Encryption
{
  /**
   * Transforms the given hex numeric character to integer.
   * For example: a given '2' will transformed to 2; 'B' to 12.
   * @param c character to transform [0..9, 'A'..'F']; no lower case letters
   * @return integer value of the given character
   */
  int hexbyt( const char c );

  /**
   * Encrypts the the password in the given url and returns it.
   * The encryption algorithm uses host and user name to crypt the password.
   * @param url the url with password, host and user name
   * @return encrypted password
   */
  const TQString crypt( const KURL& url );

  /**
   * Decrypts the given encrypted password.
   * @param pass encrypted password
   * @return decrypted password
     */
  const TQString decrypt( const TQString& pass );
}