~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/base64/base64.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   From:  http://www.adp-gmbh.ch/cpp/common/base64.html
3
 
 
4
 
   base64.cpp and base64.h
5
 
 
6
 
   Copyright (C) 2004-2008 René Nyffenegger
7
 
 
8
 
   This source code is provided 'as-is', without any express or implied
9
 
   warranty. In no event will the author be held liable for any damages
10
 
   arising from the use of this software.
11
 
 
12
 
   Permission is granted to anyone to use this software for any purpose,
13
 
   including commercial applications, and to alter it and redistribute it
14
 
   freely, subject to the following restrictions:
15
 
 
16
 
   1. The origin of this source code must not be misrepresented; you must not
17
 
      claim that you wrote the original source code. If you use this source code
18
 
      in a product, an acknowledgment in the product documentation would be
19
 
      appreciated but is not required.
20
 
 
21
 
   2. Altered source versions must be plainly marked as such, and must not be
22
 
      misrepresented as being the original source code.
23
 
 
24
 
   3. This notice may not be removed or altered from any source distribution.
25
 
 
26
 
   René Nyffenegger rene.nyffenegger@adp-gmbh.ch
27
 
 
28
 
   This file was modified by jmarantz@google.com to:
29
 
      - add a web-safe variant that uses '-' and '_' in lieu of '+' and '/'
30
 
      - change the 'decode' interface to return false if the input contains
31
 
        characters not in the expected char-set.
32
 
*/
33
 
 
34
 
#ifndef THIRD_PARTY_BASE64_BASE64_H_
35
 
#define THIRD_PARTY_BASE64_BASE64_H_
36
 
 
37
 
#include <string>
38
 
 
39
 
// Initialize the base64 library.  Call this before other methods if
40
 
// multi-threaded access is required.
41
 
void base64_init();
42
 
 
43
 
// Encode/deocde strings in common base64 encoding
44
 
std::string base64_encode(const unsigned char* data, unsigned int len);
45
 
bool base64_decode(const std::string& s, std::string* output);
46
 
 
47
 
// Encode/deocde strings in a base64 encoding for URL values.
48
 
std::string web64_encode(const unsigned char* data, unsigned int len);
49
 
bool web64_decode(const std::string& s, std::string* output);
50
 
 
51
 
#endif  // THIRD_PARTY_BASE64_BASE64_H_