資源簡介
已經用在項目上。
代碼片段和文件信息
/*
?*??RFC?1521?base64?encoding/decoding
?*
?*??Copyright?(C)?2006-2010?Brainspark?B.V.
?*
?*??This?file?is?part?of?PolarSSL?(http://www.polarssl.org)
?*??Lead?Maintainer:?Paul?Bakker?
?*
?*??All?rights?reserved.
?*
?*??This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*??it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*??the?Free?Software?Foundation;?either?version?2?of?the?License?or
?*??(at?your?option)?any?later?version.
?*
?*??This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*??but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*??MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*??GNU?General?Public?License?for?more?details.
?*
?*??You?should?have?received?a?copy?of?the?GNU?General?Public?License?along
?*??with?this?program;?if?not?write?to?the?Free?Software?Foundation?Inc.
?*??51?Franklin?Street?Fifth?Floor?Boston?MA?02110-1301?USA.
?*/
#include?“stm32f10x.h“
#if?1 //defined(POLARSSL_base64_C)
#include?“base64.h“
//#ifdef?_MSC_VER
//#include?setsd.h>
//typedef?UINT32?uint32_t;
//#else
//#include?
//#endif
static?const?unsigned?char?base64_enc_map[64]?=
{
????‘A‘?‘B‘?‘C‘?‘D‘?‘E‘?‘F‘?‘G‘?‘H‘?‘I‘?‘J‘
????‘K‘?‘L‘?‘M‘?‘N‘?‘O‘?‘P‘?‘Q‘?‘R‘?‘S‘?‘T‘
????‘U‘?‘V‘?‘W‘?‘X‘?‘Y‘?‘Z‘?‘a‘?‘b‘?‘c‘?‘d‘
????‘e‘?‘f‘?‘g‘?‘h‘?‘i‘?‘j‘?‘k‘?‘l‘?‘m‘?‘n‘
????‘o‘?‘p‘?‘q‘?‘r‘?‘s‘?‘t‘?‘u‘?‘v‘?‘w‘?‘x‘
????‘y‘?‘z‘?‘0‘?‘1‘?‘2‘?‘3‘?‘4‘?‘5‘?‘6‘?‘7‘
????‘8‘?‘9‘?‘+‘?‘/‘
};
static?const?unsigned?char?base64_dec_map[128]?=
{
????127?127?127?127?127?127?127?127?127?127
????127?127?127?127?127?127?127?127?127?127
????127?127?127?127?127?127?127?127?127?127
????127?127?127?127?127?127?127?127?127?127
????127?127?127??62?127?127?127??63??52??53
?????54??55??56??57??58??59??60??61?127?127
????127??64?127?127?127???0???1???2???3???4
??????5???6???7???8???9??10??11??12??13??14
?????15??16??17??18??19??20??21??22??23??24
?????25?127?127?127?127?127?127??26??27??28
?????29??30??31??32??33??34??35??36??37??38
?????39??40??41??42??43??44??45??46??47??48
?????49??50??51?127?127?127?127?127
};
/*
?*?Encode?a?buffer?into?base64?format
?*/
int?base64_encode(?unsigned?char?*dst?size_t?*dlen
???????????????????const?unsigned?char?*src?size_t?slen?)
{
????size_t?i?n;
????int?C1?C2?C3;
????unsigned?char?*p;
????if(?slen?==?0?)
????????return(?0?);
????n?=?(slen?<3)?/?6;
????switch(?(slen?<3)?-?(n?*?6)?)
????{
????????case??2:?n?+=?3;?break;
????????case??4:?n?+=?2;?break;
????????default:?break;
????}
????if(?*dlen?????{
????????*dlen?=?n?+?1;
????????return(?POLARSSL_ERR_base64_BUFFER_TOO_SMALL?);
????}
????n?=?(slen?/?3)?*?3;
????for(?i?=
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????6589??2020-10-29?10:39??STM32F103-ba
?????文件???????3059??2020-10-28?18:28??STM32F103-ba
?????文件????????411??2020-10-29?11:20??STM32F103-ba
?????目錄??????????0??2020-10-29?11:14??STM32F103-ba
-----------?---------??----------?-----??----
????????????????10059????????????????????4
- 上一篇:c++ 求兩個數的和
- 下一篇:VC++ 串口
評論
共有 條評論