#ifndef dvd_css_h
#define dvd_css_h

#define DVD_BLOCK_SIZE 2048
#define DVD_DISCKEYS_SIZE DVD_BLOCK_SIZE
#define DVD_KEY_SIZE 5

#include <stdint.h>

typedef uint8_t dvd_key_t[DVD_KEY_SIZE];

void css_cryptKey(int type, int variant, const uint8_t* challenge, dvd_key_t key);
void css_decryptKey(uint8_t invert, const uint8_t* key, const uint8_t* crypted, dvd_key_t result);
void css_unscramble(dvd_key_t key, uint8_t* sector);
int css_decryptDiscKey(const uint8_t discKeys[DVD_DISCKEYS_SIZE], dvd_key_t discKey);
int css_attackPattern(const uint8_t* sector, uint8_t* key, int* tries);

#endif
