How to convert Byte Array to hex string in visual c++?

前端 未结 5 1184
野性不改
野性不改 2021-01-11 16:59

Declaration of a method are following:

//some.h
void TDES_Decryption(BYTE *Data, BYTE *Key, BYTE *InitalVector, int Length);

I am calling t

5条回答
  •  星月不相逢
    2021-01-11 17:40

    how about using the boost library like this (snippet taken from http://theboostcpplibraries.com/boost.algorithm ):

    #include 
    #include 
    #include 
    #include 
    #include 
    
    using namespace boost::algorithm;
    
    int main()
    {
      std::vector v{'C', '+', '+'};
      hex(v, std::ostream_iterator{std::cout, ""});
      std::cout << '\n';
    
      std::string s = "C++";
      std::cout << hex(s) << '\n';
    
      std::vector w{'4', '3', '2', 'b', '2', 'b'};
      unhex(w, std::ostream_iterator{std::cout, ""});
      std::cout << '\n';
    
      std::string t = "432b2b";
      std::cout << unhex(t) << '\n';
    }
    

提交回复
热议问题