⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 libdvbcsa is a implementation of the DVB Common Scrambling Algorithm
💻
字号:
Introduction============libdvbcsa is a free and portable implementation of the DVB CommonScrambling algorithm with decryption and encryption capabilities.It comes in two flavors: a classical single packet implementation anda faster parallel bitslice implementation.Installation============Some configuration options are available to tune performance of theparallel implementation. See INSTALL.Algorithm overview==================The DVB CSA is composed of a two distinct ciphers which are applied toscrambled content data packets. The block cipher and the stream cipherboth use the same 64 bits key. This key is called a control word.Classical implementation API============================The classical implementation can process a single packet on eachfunction call. It is the slowest implementation and must be used whendata packets are not available as a large batch at the same time.This implementation average processing bitrate is between 20 Mbits/sand 50 Mbits/s on modern PCs.    #include <dvbcsa/dvbcsa.h>Two functions are available to allocate and free expanded key context:    struct dvbcsa_key_s * dvbcsa_key_alloc();    void dvbcsa_key_free(struct dvbcsa_key_s *key);The control word can be changed as needed using this function:    void dvbcsa_key_set (const dvbcsa_cw_t cw,                         struct dvbcsa_key_s *key);Data encryption and decryption is done with these functions:     void dvbcsa_decrypt (const struct dvbcsa_key_s *key,     	  	          unsigned char *data, unsigned int len);     void dvbcsa_encrypt (const struct dvbcsa_key_s *key,                          unsigned char *data, unsigned int len);Parallel implementation API===========================The parallel implementation is faster but data packets need to bebatched together.This implementation average processing bitrate is between 80 Mbits/sand 200 Mbits/s on modern PCs. Performance heavily depends on bitsliceword width used, see install section.    #include <dvbcsa/dvbcsa.h>Two functions are available to allocate and free expanded key context:    struct dvbcsa_bs_key_s * dvbcsa_bs_key_alloc();    void dvbcsa_bs_key_free(struct dvbcsa_bs_key_s *key);The control word can be changed as needed using this function:    void dvbcsa_bs_key_set(const dvbcsa_cw_t cw,                           struct dvbcsa_bs_key_s *key);Packet batch must be available as an array of struct dvbcsa_bs_batch_sto invoke encryption or decryption functions.    struct dvbcsa_bs_batch_s    {      unsigned char		*data;	/* pointer to payload */      unsigned int		len;	/* payload bytes lenght */    };The array must not be greater than the maximum batch size returned by:    unsigned int dvbcsa_bs_batch_size(void);An extra entry  with NULL data pointer must be  added to terminate thearray. Arrays with less entries  than the maximum batch size will takethe _same_ time to process as a full batch array.An additional maximum packet lenght  parameter must be provided to theprocessing  functions. Packet  greater than  this limit  will  only bepartially  processed. It  must  be  a multiple  of  8. This  parameterdirectly  control algorithm  cycles  count (and  processing time)  andshould be  kept as low as  possible. When processing  Mpeg TS packets,it should be 184.Encryption and decryption batch processing functions are:    void dvbcsa_bs_decrypt(const struct dvbcsa_bs_key_s *key,		           const struct dvbcsa_bs_batch_s *pcks,		           unsigned int maxlen);    void dvbcsa_bs_encrypt(const struct dvbcsa_bs_key_s *key,		           const struct dvbcsa_bs_batch_s *pcks,		           unsigned int maxlen);Example:    int i, s = dvbcsa_bs_batch_size();    struct dvbcsa_bs_batch_s b[s + 1];    struct dvbcsa_bs_key_s *key = dvbcsa_bs_key_alloc();    unsigned char cw[8] = "testtest";    dvbcsa_bs_key_set(cw, key);    for (i = 0; i < s; i++)      {        b[i].data = ... ;        b[i].len = ... ;      }    b[i].data = NULL;    dvbcsa_bs_encrypt(key, b, 184);Portability===========This library has been successfully tested on different platforms with32 bits and 64 bits word width, little-endian and big-endian bytesordering.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -