#ifndef WB_DEC_H_
#define WB_DEC_H_

#include <stdio.h>
#include <stdlib.h>
//#include <time.h>
//#include <math.h>
#include <string.h>
#include "wb_common.h"


/*
** CBC mode
** decrypt a ciphertext of any size
** pt: plaintext, ct: ciphertext, size: number of bytes, iv: initialization vector
*/
long cbc_wb_decrypt (unsigned char *pt, unsigned char *ct, long size, unsigned char *iv);

/*
** CBC mode with no padding
** decrypt a ciphertext encrypted by function cbc_wb_encrypt_nopadding() 
** pt: plaintext, ct: ciphertext, size: number of bytes, iv: initialization vector
*/
long cbc_wb_decrypt_nopadding (unsigned char *pt, unsigned char *ct, long size, unsigned char *iv);

/*
** ECB mode
** decrypt a ciphertext of any size
** pt: plaintext, ct: ciphertext, size: number of bytes
*/
long ecb_wb_decrypt (unsigned char *pt, unsigned char *ct, long size);

/*
** dncrypt a ciphertext of a block of 16 bytes
** pt: plaintext, ct: ciphertext
*/
void decBlock (unsigned char pt[16], const unsigned char ct[16]);

/*
** unpadding scheme
*/
long unpadding (unsigned char *pt_buf);

#endif /* WB_DEC_H_ */
