tsdecrypt reads and decrypts CSA encrypted incoming mpeg transport stream over UDP/RTP using code words obtained from OSCAM or similar CAM server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol. https://georgi.unixsol.org/programs/tsdecrypt/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parallel_032_4charA.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* FFdecsa -- fast decsa algorithm
  2. *
  3. * Copyright (C) 2003-2004 fatih89r
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. struct group_t{
  20. unsigned char s1[4];
  21. };
  22. typedef struct group_t group;
  23. #define GROUP_PARALLELISM 32
  24. group static inline FF0(){
  25. group res;
  26. int i;
  27. for(i=0;i<4;i++) res.s1[i]=0x0;
  28. return res;
  29. }
  30. group static inline FF1(){
  31. group res;
  32. int i;
  33. for(i=0;i<4;i++) res.s1[i]=0xff;
  34. return res;
  35. }
  36. group static inline FFAND(group a,group b){
  37. group res;
  38. int i;
  39. for(i=0;i<4;i++) res.s1[i]=a.s1[i]&b.s1[i];
  40. return res;
  41. }
  42. group static inline FFOR(group a,group b){
  43. group res;
  44. int i;
  45. for(i=0;i<4;i++) res.s1[i]=a.s1[i]|b.s1[i];
  46. return res;
  47. }
  48. group static inline FFXOR(group a,group b){
  49. group res;
  50. int i;
  51. for(i=0;i<4;i++) res.s1[i]=a.s1[i]^b.s1[i];
  52. return res;
  53. }
  54. group static inline FFNOT(group a){
  55. group res;
  56. int i;
  57. for(i=0;i<4;i++) res.s1[i]=~a.s1[i];
  58. return res;
  59. }
  60. /* 64 rows of 32 bits */
  61. void static inline FFTABLEIN(unsigned char *tab, int g, unsigned char *data){
  62. *(((int *)tab)+g)=*((int *)data);
  63. *(((int *)tab)+32+g)=*(((int *)data)+1);
  64. }
  65. void static inline FFTABLEOUT(unsigned char *data, unsigned char *tab, int g){
  66. *((int *)data)=*(((int *)tab)+g);
  67. *(((int *)data)+1)=*(((int *)tab)+32+g);
  68. }
  69. void static inline FFTABLEOUTXORNBY(int n, unsigned char *data, unsigned char *tab, int g){
  70. int j;
  71. for(j=0;j<n;j++){
  72. *(data+j)^=*(tab+4*(g+(j>=4?32-1:0))+j);
  73. }
  74. }
  75. struct batch_t{
  76. unsigned char s1[4];
  77. };
  78. typedef struct batch_t batch;
  79. #define BYTES_PER_BATCH 4
  80. batch static inline B_FFAND(batch a,batch b){
  81. batch res;
  82. int i;
  83. for(i=0;i<4;i++) res.s1[i]=a.s1[i]&b.s1[i];
  84. return res;
  85. }
  86. batch static inline B_FFOR(batch a,batch b){
  87. batch res;
  88. int i;
  89. for(i=0;i<4;i++) res.s1[i]=a.s1[i]|b.s1[i];
  90. return res;
  91. }
  92. batch static inline B_FFXOR(batch a,batch b){
  93. batch res;
  94. int i;
  95. for(i=0;i<4;i++) res.s1[i]=a.s1[i]^b.s1[i];
  96. return res;
  97. }
  98. batch static inline B_FFN_ALL_29(){
  99. batch res;
  100. int i;
  101. for(i=0;i<4;i++) res.s1[i]=0x29;
  102. return res;
  103. }
  104. batch static inline B_FFN_ALL_02(){
  105. batch res;
  106. int i;
  107. for(i=0;i<4;i++) res.s1[i]=0x02;
  108. return res;
  109. }
  110. batch static inline B_FFN_ALL_04(){
  111. batch res;
  112. int i;
  113. for(i=0;i<4;i++) res.s1[i]=0x04;
  114. return res;
  115. }
  116. batch static inline B_FFN_ALL_10(){
  117. batch res;
  118. int i;
  119. for(i=0;i<4;i++) res.s1[i]=0x10;
  120. return res;
  121. }
  122. batch static inline B_FFN_ALL_40(){
  123. batch res;
  124. int i;
  125. for(i=0;i<4;i++) res.s1[i]=0x40;
  126. return res;
  127. }
  128. batch static inline B_FFN_ALL_80(){
  129. batch res;
  130. int i;
  131. for(i=0;i<4;i++) res.s1[i]=0x80;
  132. return res;
  133. }
  134. batch static inline B_FFSH8L(batch a,int n){
  135. batch res;
  136. int i;
  137. for(i=0;i<4;i++) res.s1[i]=a.s1[i]<<n;
  138. return res;
  139. }
  140. batch static inline B_FFSH8R(batch a,int n){
  141. batch res;
  142. int i;
  143. for(i=0;i<4;i++) res.s1[i]=a.s1[i]>>n;
  144. return res;
  145. }
  146. void static inline M_EMPTY(void){
  147. }