메뉴 건너뛰기


Developer > Application

C,C++ BASE64 인코딩 디코딩

2013.11.27 00:18

푸우 조회 수:22264

Base64: Encode and Decode Base64 Files


This page describes, in Unix manual page style, a program available for downloading from this site which encodes binary files in the “Base64” format used by MIME-encoded documents such as electronic mail messages with embedded images and audio files.

NAME

base64 - encode and decode base64 files

SYNOPSIS

base64 [ -d / -e ] [ options ] [ infile ] [ outfile ]

DESCRIPTION

The MIME (Multipurpose Internet Mail Extensions) specification (RFC 1341 and successors) defines a mechanism for encoding arbitrary binary information for transmission by electronic mail. Triplets of 8-bit octets are encoded as groups of four characters, each representing 6 bits of the source 24 bits. Only characters present in all variants of ASCII and EBCDIC are used, avoiding incompatibilities in other forms of encoding such as uuencode/uudecode.

base64 is a command line utility which encodes and decodes files in this format. It can be used within a pipeline as an encoding or decoding filter, and is most commonly used in this manner as part of an automated mail processing system.

OPTIONS

--copyright
Print copyright information.
-d--decode
Decodes the input, previously created by base64, to recover the original input file.
-e--encode
Encodes the input into an output text file containing its base64 encoding.
-n--noerrcheck
Suppress error checking when decoding. By default, upon encountering a non white space character which does not belong to the base64 set, or discovering the input file is incorrectly padded to a multiple of four characters, base64 issues an error message and terminates processing with exit status 1. The -n option suppresses even this rudimentary error checking; invalid characters are silently ignored and the output truncated to the last three valid octets if the input is incorrectly padded.
-u--help
Print how to call information and a summary of options.
--version
Print program version information.

EXIT STATUS

base64 returns status 0 if processing was completed without errors, 1 if an I/O error occurred or errors were detected in decoding a file which indicate it is incorrect or incomplete, and 2 if processing could not be performed at all due, for example, to a nonexistent input file.

FILES

If no infile is specified or infile is a single “-”, base64 reads from standard input; if no outfile is given, or outfile is a single “-”, output is sent to standard output. The input and output are processed strictly serially; consequently base64 may be used in pipelines.

BUGS

Little or no error checking is done when decoding, other than validating that the input consists of a multiple of four characters in the encoding set. This is inherent in the design of base64, which assumes transmission integrity is the responsibility of a higher-level protocol.

SEE ALSO

uudecode(1), uuencode(1), RFC 1341

 Download base64-1.5.tar.gz (Gzipped TAR archive)

The archive contains source code for the utility, a Makefile for Unix systems, and a ready-to-run executable for 32-bit Windows platforms. Windows users may also download base64.zip, a ZIPped archive containing the Windows executable.

Read base64 source code (requires Acrobat Reader)

AUTHOR

John Walker 
http://www.fourmilab.ch/

Christian Ferrari contributed code which permits the base64 utility to work on EBCDIC based systems such as UNIX Services for OS/390 2.7 (ESA/390).

This software is in the public domain. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided “as is” without express or implied warranty.



출처 : http://www.fourmilab.ch/webtools/base64/
번호 제목 글쓴이 날짜 조회 수
38 Windows에서 GetLastError()의 에러 메시지 내용 출력하기 푸우 2013.11.27 15509
37 윈도우즈, 유닉스, C라이브러리 비교 - Securing Windows Objects 푸우 2013.11.27 23591
36 윈도우즈, 유닉스, C라이브러리 비교 - Asynchronous I/O 푸우 2013.11.27 23378
35 윈도우즈, 유닉스, C라이브러리 비교 - Interprocess Communication 푸우 2013.11.27 25480
34 윈도우즈, 유닉스, C라이브러리 비교 - Thread Synchronization 푸우 2013.11.27 25046
33 윈도우즈, 유닉스, C라이브러리 비교 - Threads and Scheduling 푸우 2013.11.27 23824
32 윈도우즈, 유닉스, C라이브러리 비교 - Process Management 푸우 2013.11.27 25224
31 윈도우즈, 유닉스, C라이브러리 비교 - Memory Management, Memory-Mapped Files, and DLLs 푸우 2013.11.27 26741
30 윈도우즈, 유닉스, C라이브러리 비교 - Exception Handling 푸우 2013.11.27 23951
29 윈도우즈, 유닉스, C라이브러리 비교 - File and Directory Management 푸우 2013.11.27 32734
» BASE64 인코딩 디코딩 file 푸우 2013.11.27 22264
27 mms client file 푸우 2013.11.26 15429
26 The SNIPPETS Portable C++ Source Code Archive file 푸우 2013.11.26 21992
25 The SNIPPETS Portable C Source Code Archive file 푸우 2013.11.26 16514
24 Email 포맷인 eml파일의 필터링을 위한 라이브러리 file 푸우 2013.11.26 16184
23 Linux, Unix에서 라이브러리 만들기 file 푸우 2013.11.26 15777
22 Zlib를 이용한 프로그래밍 푸우 2013.11.26 16101
21 Bit Field를 이용한 구조체 크기 줄이기 푸우 2013.11.26 15173
20 C++ 에서 C 함수의 사용하기 푸우 2013.11.26 15661
19 MD5 라이브러리 file 푸우 2013.11.26 14040