This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CommonCrypto/CommonDigest.h> | |
#include <CommonCrypto/CommonHMAC.h> | |
@interface ZRCommonCryption : NSObject | |
/** | |
* 加密方式,MAC算法: HmacSHA256 | |
* | |
* @param plaintext 要加密的文本 | |
* @param key 秘钥 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include <vector> | |
void hexchar(unsigned char c, unsigned char &hex1, unsigned char &hex2) | |
{ | |
hex1 = c / 16; | |
hex2 = c % 16; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief URLEncode 对字符串URL编码 | |
* | |
* @param str 原字符串 | |
* @param strSize 原字符串长度(不包括最后的\0) | |
* @param result 结果缓冲区的地址 | |
* @param resultSize 结果缓冲区的大小(包括最后的\0) | |
* | |
* @return: >0:resultstring 里实际有效的长度 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <zlib.h> | |
/* | |
* A good example for using zlib is correlated de/compress file instead of string | |
*/ | |
void decompress_one_file(char *infilename, char *outfilename); | |
void compress_one_file(char *infilename, char *outfilename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool CompressByGZIP(std::string & uncompressedStr, std::string & compressedStr) | |
{ | |
if (uncompressedStr.length() <= 0) { | |
return false; | |
} | |
compressedStr.resize(uncompressedStr.size() * 1.5 + 12); | |
/* Before we can begin compressing (aka "deflating") data using the zlib | |
functions, we must initialize zlib. Normally this is done by calling the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface MyView : UIView | |
@property (nonatomic, assign) BOOL isMySelf; | |
@end | |
@implementation MyView | |
- (instancetype)init | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace PushNotification | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string filepath = "C://AppPushCertificates.p12"; | |
string pwd = "your certificate passwords"; | |
PushNotification pushNotification = new PushNotification(PushNotificationType.Distribution, filepath, pwd); | |
PushNotificationPayload payload = new PushNotificationPayload(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ViewController.h" | |
@interface ViewController ()<NSURLSessionDelegate> | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data; | |
using System.IO; | |
using NPOI.HSSF.UserModel; | |
using NPOI.SS.UserModel; | |
using NPOI.XSSF.UserModel; | |
namespace MyNameSpace | |
{ | |
public static class NPOIHelper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <codecvt> | |
std::string VLUtilitiesEncoding::UTF8Encoding(std::string & unencodedStr) | |
{ | |
if (unencodedStr.length() <= 0) return ""; | |
std::wstring_convert<std::codecvt_utf8<wchar_t>,wchar_t> conversion; | |
std::wstring wbodyStr = conversion.from_bytes(unencodedStr); | |
return conversion.to_bytes(wbodyStr); |
OlderNewer