PDA

Просмотр полной версии : Бинарное преобразование


zloy_kaktus
06.12.2006, 15:19
С помощью какой проги можно перевести любой файл в буквенно-циферный вариант и обратно..?

VictorS
06.12.2006, 15:29
zloy_kaktus, что ты подразумеваешь под своими словами? Тебе нужно бинарный файл в Base64 закодировать?

zloy_kaktus
06.12.2006, 15:32
Ну например есть простой файл jpg хочу перевести его в буквенно-цифровой формат сохранить а потом обратно jpg

VictorS
06.12.2006, 15:47
Да, это называется Base64 (http://ru.wikipedia.org/wiki/Base64). Этот формат используется в электронной почте (MIME) для прикрепления файлов. В нем используются только символы латинского алфавита в верхнем и нижнем регистре — символы (A—Z, a—z), цифры (0—9), и символы «+» и «/», с символом «=» в качестве специального кода суффикса. Полная спецификация этой формы base64 содержится в RFC 1421 и RFC 2045. Результирующие закодированные по base64 данные имеют длину, большую оригинальной в соотношении 4:3, и напоминают по виду случайные символы.
Нашел консольную утилитку (http://disk.karelia.ru/?f=VictorS/Soft/base64.zip&d=1), которую использовать так:
base64 [ -d / -e ] [ options ] [ infile ] [ outfile ]
--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.