File qmc.h
Go to the documentation of this file
#ifndef QQMUSIC_CRYPTO_QMC_H
#define QQMUSIC_CRYPTO_QMC_H
#include <cstdint>
#include <memory>
#include <qqmusic/crypto/cipher_map.h>
#include <qqmusic/crypto/cipher_rc4.h>
#include <qqmusic/crypto/cipher_tea.h>
#include <qqmusic/crypto/key_derive.h>
#include <qqmusic/details/result.h>
#include <qqmusic/utils/buffer.h>
#include <vector>
namespace qqmusic::crypto {
class Decoder {
public:
explicit Decoder() = default;
Decoder(Decoder&&) = default;
Decoder& operator=(Decoder&&) = default;
Decoder(const Decoder&) = delete;
Decoder& operator=(const Decoder&) = delete;
Result<qqmusic::utils::buffer> decrypt(std::string_view ekey, qqmusic::utils::buffer&& buf);
private:
std::vector<uint8_t> key;
qqmusic::utils::buffer buf_in{1024};
qqmusic::utils::buffer buf_out{1024};
std::unique_ptr<qqmusic::crypto::Cipher> cipher;
};
} // namespace qqmusic::crypto
#endif // !QQMUSIC_CRYPTO_QMC_H