• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • text
kcodecs.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org>
3  Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License (LGPL)
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 
18  RFC 1321 "MD5 Message-Digest Algorithm" Copyright (C) 1991-1992. // krazy:exclude=copyright
19  RSA Data Security, Inc. Created 1991. All rights reserved.
20 
21  The KMD5 class is based on a C++ implementation of
22  "RSA Data Security, Inc. MD5 Message-Digest Algorithm" by
23  Mordechai T. Abzug, Copyright (c) 1995. This implementation // krazy:exclude=copyright
24  passes the test-suite as defined in RFC 1321.
25 
26  The encoding and decoding utilities in KCodecs with the exception of
27  quoted-printable are based on the java implementation in HTTPClient
28  package by Ronald Tschalär Copyright (C) 1996-1999. // krazy:exclude=copyright
29 
30  The quoted-printable codec as described in RFC 2045, section 6.7. is by
31  Rik Hemsley (C) 2001.
32 */
33 
34 #ifndef KCODECS_H
35 #define KCODECS_H
36 
37 #define KBase64 KCodecs
38 
39 #include <kdecore_export.h>
40 
41 class QByteArray;
42 class QIODevice;
43 
74 namespace KCodecs
75 {
85  KDECORE_EXPORT QByteArray quotedPrintableEncode(const QByteArray & in,
86  bool useCRLF = true);
87 
106  KDECORE_EXPORT void quotedPrintableEncode(const QByteArray & in, QByteArray& out,
107  bool useCRLF);
108 
117  KDECORE_EXPORT QByteArray quotedPrintableDecode(const QByteArray & in);
118 
136  KDECORE_EXPORT void quotedPrintableDecode(const QByteArray & in, QByteArray& out);
137 
138 
150  KDECORE_EXPORT QByteArray uuencode( const QByteArray& in );
151 
167  KDECORE_EXPORT void uuencode( const QByteArray& in, QByteArray& out );
168 
179  KDECORE_EXPORT QByteArray uudecode( const QByteArray& in );
180 
200  KDECORE_EXPORT void uudecode( const QByteArray& in, QByteArray& out );
201 
202 
216  KDECORE_EXPORT QByteArray base64Encode( const QByteArray& in, bool insertLFs = false);
217 
239  KDECORE_EXPORT void base64Encode( const QByteArray& in, QByteArray& out,
240  bool insertLFs = false );
241 
249  KDECORE_EXPORT QByteArray base64Decode( const QByteArray& in );
250 
268  KDECORE_EXPORT void base64Decode( const QByteArray& in, QByteArray& out );
269 
270 
280  KDECORE_EXPORT QString decodeRFC2047String(const QString &text);
281 
282 
283 }
284 
285 class KMD5Private;
331 class KDECORE_EXPORT KMD5
332 {
333 public:
334 
335  typedef unsigned char Digest[16];
336 
337  KMD5();
338  ~KMD5();
339 
348  explicit KMD5(const char* in, int len = -1);
349 
355  explicit KMD5(const QByteArray& a );
356 
365  void update(const char* in, int len = -1);
366 
370  void update(const unsigned char* in, int len = -1);
371 
377  void update(const QByteArray& in );
378 
390  bool update(QIODevice& file);
391 
397  void reset();
398 
402  const Digest& rawDigest (); //krazy:exclude=constref (simple array)
403 
413  void rawDigest( KMD5::Digest& bin );
414 
419  QByteArray hexDigest ();
420 
424  void hexDigest(QByteArray&);
425 
430  QByteArray base64Digest ();
431 
436  bool verify( const KMD5::Digest& digest);
437 
441  bool verify(const QByteArray&);
442 
443 protected:
448  void transform( const unsigned char buffer[64] );
449 
453  void finalize();
454 
455 private:
456  KMD5(const KMD5& u);
457  KMD5& operator=(const KMD5& md);
458 
459  void init();
460  void encode( unsigned char* output, quint32 *in, quint32 len );
461  void decode( quint32 *output, const unsigned char* in, quint32 len );
462 
463  quint32 rotate_left( quint32 x, quint32 n );
464  quint32 F( quint32 x, quint32 y, quint32 z );
465  quint32 G( quint32 x, quint32 y, quint32 z );
466  quint32 H( quint32 x, quint32 y, quint32 z );
467  quint32 I( quint32 x, quint32 y, quint32 z );
468  void FF( quint32& a, quint32 b, quint32 c, quint32 d, quint32 x,
469  quint32 s, quint32 ac );
470  void GG( quint32& a, quint32 b, quint32 c, quint32 d, quint32 x,
471  quint32 s, quint32 ac );
472  void HH( quint32& a, quint32 b, quint32 c, quint32 d, quint32 x,
473  quint32 s, quint32 ac );
474  void II( quint32& a, quint32 b, quint32 c, quint32 d, quint32 x,
475  quint32 s, quint32 ac );
476 
477 private:
478  quint32 m_state[4];
479  quint32 m_count[2];
480  quint8 m_buffer[64];
481  Digest m_digest;
482  bool m_finalized;
483 
484  KMD5Private* d;
485 };
486 
487 
488 #endif // KCODECS_H
QIODevice
kdecore_export.h
QByteArray
KCodecs::decodeRFC2047String
QString decodeRFC2047String(const QString &text)
Decodes string text according to RFC2047, i.e., the construct =?charset?[qb]?encoded?=.
Definition: kcodecs.cpp:693
quint32
KCodecs::uudecode
QByteArray uudecode(const QByteArray &in)
Decodes the given data using the uudecode algorithm.
Definition: kcodecs.cpp:598
F
#define F
KCodecs::base64Decode
QByteArray base64Decode(const QByteArray &in)
Decodes the given data that was encoded using the base64 algorithm.
Definition: kcodecs.cpp:424
QString
KCodecs::quotedPrintableEncode
QByteArray quotedPrintableEncode(const QByteArray &in, bool useCRLF=true)
Encodes the given data using the quoted-printable algorithm.
Definition: kcodecs.cpp:156
I
#define I
KMD5
An adapted C++ implementation of RSA Data Securities MD5 algorithm.
Definition: kcodecs.h:331
KCodecs::base64Encode
QByteArray base64Encode(const QByteArray &in, bool insertLFs=false)
Encodes the given data using the base64 algorithm.
Definition: kcodecs.cpp:345
output
void output(QList< Action > actions, QHash< QString, QString > domain)
Definition: fake/kauth-policy-gen-polkit.cpp:41
KCodecs::uuencode
QByteArray uuencode(const QByteArray &in)
Encodes the given data using the uuencode algorithm.
Definition: kcodecs.cpp:512
KMD5::Digest
unsigned char Digest[16]
Definition: kcodecs.h:335
KCodecs::quotedPrintableDecode
QByteArray quotedPrintableDecode(const QByteArray &in)
Decodes a quoted-printable encoded data.
Definition: kcodecs.cpp:279
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal