[암호화 관련] C++ 하고 C# 하고 동일하게 짜고 싶은데요.
제가 암호화 모듈을 만드는데요
c++ c# 모듈을 만들어서 서로 통신이 가능하게 하는건데요
저렇게 바이트를 바꿔주면 처리가 안되네요...
아래 로직을 지우면 잘 처리 되는데요
rawKey 값 하고 byteKey 값하고 동일하게 하고 싶은데요
문의드립니다.
/*** C++ 소스 ***/
unsigned char rawKey[33]= "3B8E262739AED3A7ABF8269910CF5F4C";
std::string chain = "학습123";
unsigned char charChain[6];
memcpy(charChain, chain.c_str(), 6);
//3,5,9,11,24,27 번째 바이트만 교환한다.
rawKey[3] = charChain[0];
rawKey[5] = charChain[1];
rawKey[9] = charChain[2];
rawKey[11] = charChain[3];
rawKey[24] = charChain[4];
rawKey[27] = charChain[5];
/*** C# 소스 ***/
string fKey = "3B8E262739AED3A7ABF8269910CF5F4C";
string Key = "학습123";
byte[] byteKey = Encoding.Default.GetBytes(fKey);
byte[] bytefKey = Encoding.Default.GetBytes(Key);
//3,5,9,11,24,27 번째 바이트만 교환한다.
byteKey[3] = bytefKey[0];
byteKey[5] = bytefKey[1];
byteKey[9] = bytefKey[2];
byteKey[11] = bytefKey[3];
byteKey[24] = bytefKey[4];
byteKey[27] = bytefKey[5];
댓글 달기