是否有可能为base64-CN code块中的一个文件? [英] Is it possible to base64-encode a file in chunks?

查看:177
本文介绍了是否有可能为base64-CN code块中的一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为Base64 EN codeA巨大的输入文件,并用文本输出文件结束了,而我试图找出是否是可能的EN code输入文件位逐位,或者我是否需要EN code整个事情一次。

I'm trying to base64 encode a huge input file and end up with an text output file, and I'm trying to find out whether it's possible to encode the input file bit-by-bit, or whether I need to encode the entire thing at once.

这将在AS / 400(i系列)来完成,如果有什么差别。我用我自己的base64编码程序(写在RPG)的工作出色,而且,它是大小限制不成的情况下,就可以了。

This will be done on the AS/400 (iSeries), if that makes any difference. I'm using my own base64 encoding routine (written in RPG) which works excellently, and, were it not a case of size limitations, would be fine.

推荐答案

这是不可能的逐位,但第3,一次字节或在时间的3个字节的倍数会做

在换句话说,如果你在块的大小(s)是(有)的3个字节的倍数,可以连接code单独的块和拼凑产生的B64-CN $ C拆分输入文件$光盘片一起(在相应的奥德当然,需要注意的是,最后chuink不需要的大小的3个字节,这取决于它的尺寸的模3值完全多其相应的B64值将有几个,这些填充字符(通常为等号),但没关系,因为thiswill是具有唯一的一块(和需求)等填充。

In other words if you split your input file in "chunks" which size(s) is (are) multiples of 3 bytes, you can encode the chunks separately and piece together the resulting B64-encoded pieces together (in the corresponding orde, of course. Note that the last chuink needn't be exactly a multiple of 3 bytes in size, depending on the modulo 3 value of its size its corresponding B64 value will have a few of these padding characters (typically the equal sign) but that's ok, as thiswill be the only piece that has (and needs) such padding.

在解码的方向,它是除了需要在4个字节的倍数的B64烯$ C $光盘数据拆分同样的想法。德code他们并联/单独根据需要和再片由(再次以相同的顺序)的德$ C $光盘部件附加共同的原始数据

In the decoding direction, it is the same idea except that you need to split the B64-encoded data in multiples of 4 bytes. Decode them in parallel / individually as desired and re-piece the original data by appending the decoded parts together (again in the same order).

示例:

文件内容=
决不数据争辩。 (吉米)。结果
直编码= Ik5ldmVyIGFyZ3VlIHdpdGggdGhlIGRhdGEuIiAoSmltbXkgTmV1dHJvbik = 搜索

现在,在大块:结果
不要争论   - >   Ik5ldmVyIGFyZ3Vl 结果
         - >        IHdpdGggdGhl 结果
数据(吉米) - > IGRhdGEuIiAoSmltbXkgTmV1dHJvbik =

Now, in chunks:
"Never argue     -->     Ik5ldmVyIGFyZ3Vl
with the         -->        IHdpdGggdGhl
data." (Jimmy Neutron) --> IGRhdGEuIiAoSmltbXkgTmV1dHJvbik=

正如你所看到的顺序在3间codeD大块量相同的整个文件产生的code片。

As you see piece in that order the 3 encoded chunks amount the same as the code produced for the whole file.

解码类似地完成的,具有任意chuncked尺寸,只要它们是4字节的倍数。其实完全不需要有任何种类的用于编码的大小之间对应关系的。 (虽然规范到一个单一的大小,每个方向(比如300和400)可能使事情变得更均匀,更易于管理。

Decoding is done similarly, with arbitrary chuncked sized provided they are multiples of 4 bytes. There is absolutely not need to have any kind of correspondance between the sizes used for encoding. (although standardizing to one single size for each direction (say 300 and 400) may makes things more uniform and easier to manage.

这篇关于是否有可能为base64-CN code块中的一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆