Muaj pes tsawg bytes yog base64?
Muaj pes tsawg bytes yog base64?

Video: Muaj pes tsawg bytes yog base64?

Video: Muaj pes tsawg bytes yog base64?
Video: NYOB TSIS TAU YOG TSIS MUAJ KOJ - Mim Yaj 2024, Kaum ib hlis
Anonim

Base64 siv 4 ascii cim los encode 24-ntsis ( 3 bytes ) cov ntaub ntawv. Yuav kom encode, nws splits li lub peb bytes rau hauv 46-ntsis tus lej. Tus lej 6-ntsis tuaj yeem sawv cev 64 qhov ua tau.

Cov lus nug tseem yog, qhov loj npaum li cas yog ib txoj hlua base64?

Cov tswv yim txoj hlua yog 3 bytes, lossis 24 ntsis, hauv qhov loj , yog li cov qauv raug kwv yees tias cov zis yuav yog 4bytes (lossis 32 khoom) ntev : TWS. Cov txheej txheem encodes txhua 6 cov ntaub ntawv rau hauv ib qho ntawm 64 Base 64 cov cim, yog li cov tswv yim 24-ntsis muab faib los ntawm 6 cov txiaj ntsig hauv 4 Base 64 cov cim.

Tom qab, lo lus nug yog, base64 encoded cov ntaub ntawv yog dab tsi? Hauv computer science, Base 64 yog ib pawg ntawm binary-to-text encoding schemes uas sawv cev binary cov ntaub ntawv nyob rau hauv ASCII txoj hlua hom los ntawm kev txhais nws mus rau aradix-64 sawv cev. Lub sij hawm Base 64 originates los ntawm aspecific MIME cov ntsiab lus hloov encoding.

Ib sab saum toj no, base64 nce loj npaum li cas?

Base 64 encodes txhua pawg ntawm peb bytes rau hauv plaubbytes. Tsis tas li ntawd, cov zis yog padded ib txwm ua ntau yam offour. Yog li, rau 16kB array, lub hauv paus-64 tus sawv cev yuav beceil (16 * 1024/3) * 4 = 21848 bytes ntev ~ = 21.8kB. Kev kwv yees kwv yees yuav be tias qhov loj ntawm cov ntaub ntawv yog nce mus rau 4/3 ntawm qhov qub.

Puas yog base64 ib txwm xaus rau ==?

Teb lus teb ntxiv yog tias a puag 64 encoded txoj hlua tsis ib txwm kawg nrog a =, it yuav nkaus xwb kawg nrog ib lossis ob = yog tias lawv yuav tsum tau pad thestring tawm mus rau qhov ntev. 2- Raws li cov lus teb luv luv: 65th cim ("=" kos npe) yog tsuas yog siv los ua ib qho ntxiv hauv cov txheej txheem kawg ntawm kev encoding lus.

Pom zoo: