在this question中,我问如何在MSSQL中将varbinary
转换为有效的BASE64 string
值。
现在我想知道怎么做没有MSSQL (在.NET f.e。中)。
让我们想一个接受以下string
(或byte
数组)的方法
0x1F8B0800000000000400CD57DB6EDB38107D5F60FF81E0D31648C5247DD906528BD4898BA075525469DF6969EC10CB8BCA4B607F5B1FFA49FB0B3BBACB521CB7E9A228020422357366E6F0CC50FEF7EBB7F8F54649720FD609A3137A121D53023A33B9D0EB8406BF7AFE377DFDEACF3FE2CB5C6DC8E7D6EE4569879EDA25F4CEFBE28C3197DD81E22E5222B3C699958F32A318CF0D3B3D3E7EC94E4E182004452C42E28F417BA1A05AE072667406850F5C2E4C0ED235FBF826AD50C93557E00A9E414253AE0A0917DCF325771035CB254278D8784ACEA5E098550A724509D7DA78EE31E7B34F0E526F8D5EA7056E7079BB2D00ED565C3A686A39EBCDBFB7ACE3D3B22CD63BB6505970DEA81F043C79D1F0C4C6EE4F629B763C229397C8B8DF9655576C26746E0C25E3386733694B9B433C47159C001721CC11D9353EEA84827A2AFF8EC82C481F2C241A82B75C1E910F612945F60EB6B7E61FD0890E520ED3C584F1DDCE066E7DB0A600EBB71F61D514719553C276FDD8D8B1731BF8D435BE0D029FAF31365F4AE8C4C01E752FFFB700A8286C144A167CF31EF4DADF25141F29998B0DE4ED4E83FA490BEC2B74F2368C82C4AC3F9DE999959473A1C136094C243F3944D47A738EAE09B75B518D9B82EFA5E028E973A8DB27AA14F2509E5D467DA3B2BA53DB8E667B5A3A5EF0A240CA062DDEEC90B4EEEFD9F3F4C7C5AE6A0C96B90734DF65DB45F2C6F2358CDE6268CC742EACF3AD902999E56A6236E67F0FB76DB401C5633DF78CB7C6E5F3CE29EFEBBFF26C46703D97732C4F81F655A5D06554F7FCC4AB1AB35C72FB409FCC8C0C4AEFEBB5C7BCEB3619FAD73B5384988DD21ED3C4263C8D3A7ECCF963921D9B74D13BE98E241A3772397C354DF4539B5082D4DC8BBCD2CED67950516910A55FE44C0AACB73758702D56E07C3D1429DE08A7A31BEDF7B95D9873B93C7CC5FCF2A11EB4F81200D9C46C5602EC4F0D787DCF6D76C7ED5F8A6F9E0D917E76884F67CDC111BD6F42D72A4B68BEC4C56D9D5E3DD19F38BBA7828FD9F08B2DBE0027D63D44F9FDA6212B95D483B636577A655A82B19C6146ADC988FF05789E232BE7160F90671E5F67E05C75D17EE632A0C9A55A427EA56F822F823F770ED4526E87F5C6ECF1F8D505B59B737C53942BF77F9480690A2C016EF49B2064DEE53D9FEA6F1F442990B780FB5587E28706C2ADB71DD2B5D1DF09D4D0770105E8B2296E016F120473373AE5F7F094DCF0FBE23DAC79B66DE7D67E90C307B14B7B7C21F8DA72E51A8CDEBFFC15C2CA9F21AFFE038574340FB80C0000
并返回有效的BASE64
H4sIAAAAAAAEAM1X227bOBB9X2D/geDTFkjFJH3ZBlKL1ImLoHVSVGnfaWnsEMuLyktgf1sf+kn7Czu6y1Ict+miKAIEIjVzZubwzFD+9+u3+PVGSXIP1gmjE3oSHVMCOjO50OuEBr96/jd9/erPP+LLXG3I59buRWmHntol9M774owxl92B4i5SIrPGmZWPMqMYzw07PT5+yU5OGCAERSxC4o9Be6GgWuByZnQGhQ9cLkwO0jX7+CatUMk1V+AKnkFCU64KCRfc8yV3EDXLJUJ42HhKzqXgmFUKckUJ19p47jHns08OUm+NXqcFbnB5uy0A7VZcOmhqOevNv7es49OyLNY7tlBZcN6oHwQ8edHwxMbuT2Kbdjwik5fIuN+WVVdsJnRuDCXjOGczaUubQzxHFZwAFyHMEdk1PuqEgnoq/47ILEgfLCQagrdcHpEPYSlF9g62t+Yf0IkOUg7TxYTx3c4Gbn2wpgDrtx9h1RRxlVPCdv3Y2LFzG/jUNb4NAp+vMTZfSujEwB51L/+3AKgobBRKFnzzHvTa3yUUHymZiw3k7U6D+kkL7Ct08jaMgsSsP53pmZWUc6HBNglMJD85RNR6c46uCbdbUY2bgu+l4Cjpc6jbJ6oU8lCeXUZ9o7K6U9uOZntaOl7wokDKBi3e7JC07u/Z8/THxa5qDJa5BzTfZdtF8sbyNYzeYmjMdC6s862QKZnlamI25n8Pt220AcVjPfeMt8bl884p7+u/8mxGcD2XcyxPgfZVpdBlVPf8xKsas1xy+0CfzIwMSu/rtce86zYZ+tc7U4SYjdIe08QmPI06fsz5Y5Idm3TRO+mOJBo3cjl8NU30U5tQgtTci7zSztZ5UFFpEKVf5EwKrLc3WHAtVuB8PRQp3ginoxvt97ldmHO5PHzF/PKhHrT4EgDZxGxWAuxPDXh9z212x+1fim+eDZF+dohPZ83BEb1vQtcqS2i+xMVtnV490Z84u6eCj9nwiy2+ACfWPUT5/aYhK5XUg7Y2V3plWoKxnGFGrcmI/wV4niMr5xYPkGceX2fgXHXRfuYyoMmlWkJ+pW+CL4I/dw7UUm6H9cbs8fjVBbWbc3xTlCv3f5SAaQosAW70myBk3uU9n+pvH0QpkLeA+1WH4ocGwq23HdK10d8J1NB3AQXosiluAW8SBHM3OuX38JTc8PviPax5tm3n1n6QwwexS3t8IfjacuUajN6//BXCyp8hr/4DhXQ0D7gMAAA=
答案 0 :(得分:1)
答案 1 :(得分:0)
您可以使用C#方法Convert.ToBase64String()
。将字节数组作为参数传递给此方法,它将返回它的base64字符串。