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_064_2int.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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 int s1;
  21. unsigned int s2;
  22. };
  23. typedef struct group_t group;
  24. #define GROUP_PARALLELISM 64
  25. group static inline FF0(){
  26. group res;
  27. res.s1=0x0;
  28. res.s2=0x0;
  29. return res;
  30. }
  31. group static inline FF1(){
  32. group res;
  33. res.s1=0xffffffff;
  34. res.s2=0xffffffff;
  35. return res;
  36. }
  37. group static inline FFAND(group a,group b){
  38. group res;
  39. res.s1=a.s1&b.s1;
  40. res.s2=a.s2&b.s2;
  41. return res;
  42. }
  43. group static inline FFOR(group a,group b){
  44. group res;
  45. res.s1=a.s1|b.s1;
  46. res.s2=a.s2|b.s2;
  47. return res;
  48. }
  49. group static inline FFXOR(group a,group b){
  50. group res;
  51. res.s1=a.s1^b.s1;
  52. res.s2=a.s2^b.s2;
  53. return res;
  54. }
  55. group static inline FFNOT(group a){
  56. group res;
  57. res.s1=~a.s1;
  58. res.s2=~a.s2;
  59. return res;
  60. }
  61. /* 64 rows of 64 bits */
  62. void static inline FFTABLEIN(unsigned char *tab, int g, unsigned char *data){
  63. *(((int *)tab)+2*g)=*((int *)data);
  64. *(((int *)tab)+2*g+1)=*(((int *)data)+1);
  65. }
  66. void static inline FFTABLEOUT(unsigned char *data, unsigned char *tab, int g){
  67. *((int *)data)=*(((int *)tab)+2*g);
  68. *(((int *)data)+1)=*(((int *)tab)+2*g+1);
  69. }
  70. void static inline FFTABLEOUTXORNBY(int n, unsigned char *data, unsigned char *tab, int g){
  71. int j;
  72. for(j=0;j<n;j++){
  73. *(data+j)^=*(tab+8*g+j);
  74. }
  75. }
  76. struct batch_t{
  77. unsigned int s1;
  78. unsigned int s2;
  79. };
  80. typedef struct batch_t batch;
  81. #define BYTES_PER_BATCH 8
  82. batch static inline B_FFAND(batch a,batch b){
  83. batch res;
  84. res.s1=a.s1&b.s1;
  85. res.s2=a.s2&b.s2;
  86. return res;
  87. }
  88. batch static inline B_FFOR(batch a,batch b){
  89. batch res;
  90. res.s1=a.s1|b.s1;
  91. res.s2=a.s2|b.s2;
  92. return res;
  93. }
  94. batch static inline B_FFXOR(batch a,batch b){
  95. batch res;
  96. res.s1=a.s1^b.s1;
  97. res.s2=a.s2^b.s2;
  98. return res;
  99. }
  100. batch static inline B_FFN_ALL_29(){
  101. batch res;
  102. res.s1=0x29292929;
  103. res.s2=0x29292929;
  104. return res;
  105. }
  106. batch static inline B_FFN_ALL_02(){
  107. batch res;
  108. res.s1=0x02020202;
  109. res.s2=0x02020202;
  110. return res;
  111. }
  112. batch static inline B_FFN_ALL_04(){
  113. batch res;
  114. res.s1=0x04040404;
  115. res.s2=0x04040404;
  116. return res;
  117. }
  118. batch static inline B_FFN_ALL_10(){
  119. batch res;
  120. res.s1=0x10101010;
  121. res.s2=0x10101010;
  122. return res;
  123. }
  124. batch static inline B_FFN_ALL_40(){
  125. batch res;
  126. res.s1=0x40404040;
  127. res.s2=0x40404040;
  128. return res;
  129. }
  130. batch static inline B_FFN_ALL_80(){
  131. batch res;
  132. res.s1=0x80808080;
  133. res.s2=0x80808080;
  134. return res;
  135. }
  136. batch static inline B_FFSH8L(batch a,int n){
  137. batch res;
  138. res.s1=a.s1<<n;
  139. res.s2=a.s2<<n;
  140. return res;
  141. }
  142. batch static inline B_FFSH8R(batch a,int n){
  143. batch res;
  144. res.s1=a.s1>>n;
  145. res.s2=a.s2>>n;
  146. return res;
  147. }
  148. void static inline M_EMPTY(void){
  149. }