Comments (13)
See https://github.com/oscam-emu/oscam-patched/blob/master/module-emulator-biss.c#L393
and https://github.com/oscam-emu/oscam-patched/blob/master/module-dvbapi.c#L2216
from oscam-patched-old.
I assume you know how enigma2 creates the namespace (what info is included and how it is formed).
There are 2 namespace hashes, because there are 2 namespaces in enigma.
When the tsid and the onid are deemed valid by enigma, the frequency info is stripped off and the namespace contains only the orbital position. This is described here: https://github.com/oscam-emu/oscam-patched/wiki/BISS-config#note-6
So in case of "full" namespace (with frequency), we use only the namespace and the service id in the hash. We place them like this: [srvid][namespace], so we get a 2+4=6 byte long sequence. Then we create a crc32 hash of these (caid is 0x2600 for biss and used as initial value in our crc32).
In case of stripped namespace, we use the tsid and onid as well in our hash, so it is still unique. So we place then like this: [srvid][tsid][onid][namespace] and we get a 2+2+2+4=10 byte sequence, from which we calculate the crc32 hash again.
Another thing you should know is that our namespace is not exactly the same as enigma's. In our namespace, we clear the 4 most significant bits (in case of DVB-T or DVB-C they are 0xF or 0xE respectively - for DVB-S they are 0) and we replace them with 0xA. This is our flag, so the emu can tell that this is the namespace and not another pid like audio etc. This is done here: https://github.com/oscam-emu/oscam-patched/blob/master/module-dvbapi.c#L2216
So the ecm you asked is a byte sequence, part of which is the srvid, namespace, tsid, onid. The b2i and i2b functions mean buffer-to-integer and integer-to-buffer and are used to take some bytes from a buffer, e.g. take the namespace from the ecm, or vice versa, e.g. place the srvid to a specific position in the the ecm.
from oscam-patched-old.
Stripped namespace is 4 byte long, as full namespace. 00460000 is the correct. Also you forgot the flag we put in the beginning. After flagging full namespace is A0460ACB and stripped is A0460000. It's a simple "or", ens = ens | 0xA0000000
crc32 algorith in general, takes a byte string as input and calculates a 32 bit (4 byte) output string, our namespace hash.
from oscam-patched-old.
Hi dear
I understand that you have not enough time. but I'm not expert in c language.
1.is it possible explain the calculation of namespace hash algorithmically. I want this code in python language. we assume that enigma2 namespace and sid in known.
2.what is ecm and ecmLen in writed code? most of variables like srvid,tsid and ... are function of these two variables.
3. I find crc32 function in web but what are these functions? b2i() and i2b_buf()
thanks for replying and responsibility
from oscam-patched-old.
please get a valid web address about crc32 algorithm and it's function
hash = crc32(caid, ecmCopy + ecmLen - 10, 10);
is crc32() is "C" function or you create this function?
our namespace is not exactly the same as enigma's. we clear the 4 most significant bits
Is your namespace, crc32 output or input? it seems to be crc32 output.
thanks for replying and responsibility
from oscam-patched-old.
thank a lot! my problem is solved!
I am ashamed because I waste your time!
I admire and respect you because you are noble, unselfish and morally good.
I have a Criticism about oscam-emu(how read biss keys from softcam.key) that I will propose you tomorrow!
thanks for replying and responsibility
from oscam-patched-old.
Hi @oscam-emu , would you help me on this? I would like to understand how the oscam namespace hash is calculated. Can you follow this example?
data: E2 namespace: dec 4598562 (including freq)
hex namespace: => 0x00462B22
modified namespace 0xA0462B22 (adding oscam identifier)
[srvid][oscam namespace]: 0001A0462B22
How to go further? How do you calc the CRC32 on the above result.
Thak you so much.
from oscam-patched-old.
The crc32 function is defined here: https://github.com/oscam-emu/oscam-patched/blob/master/oscam-string.c#L714
A python version that produces the same hash is:
table = array('L')
for byte in range(256):
crc = 0
for bit in range(8):
if (byte ^ crc) & 1:
crc = (crc >> 1) ^ 0xEDB88320
else:
crc >>= 1
byte >>= 1
table.append(crc)
def crc32(caid, string):
value = caid ^ 0xffffffffL
for char in string:
value = table[(ord(char) ^ value) & 0xff] ^ (value >> 8)
return value ^ 0xffffffffL
from oscam-patched-old.
So I need to study some Python before attempting it. But please, in my example above, is it correct to set the string (in the crc32 func) to "0001A0462B22"? Is it the correct approach?
thx!!
from oscam-patched-old.
Yes, read the comments in the code:
https://github.com/oscam-emu/oscam-patched/blob/master/module-emulator-biss.c#L421
https://github.com/oscam-emu/oscam-patched/blob/master/module-emulator-biss.c#L426
from oscam-patched-old.
Hi, thank you.
I tried the whole process till Python, but the result differs from the suggested hash in the livelog.
Could you please have a fast look at my steps?
- Getting the E2 namespace from the DreamboxEDIT (freq 12550V, TSID 0001, ONID 0000, SID 0008 ==> E2 namespace 0x0046b106 ) or by the box itself
- Changing the namespace by adding the 0xA identifier: ==> 0xA046B106
- Adding the SRVID (SID 0008) ==> 0008A046B106
- Running the python CRC32 function, by using:
- CAID (as an integer or its hex representation 0x2600)
- ens (as a string, uppercase or lowercase? "0008A046B106", "0008a046b106") - As a result ==> a39cb7c7 (not matching with the suggested hashes from the livelog: E2F2E27D , E700CC3D)
The python code is attached.
Thanks!
from oscam-patched-old.
0x0008A046B106 is correct. You need to convert the hex data to acsii string first:
data = 0x0008A046B106
string = binascii.unhexlify(data)
b = crc32(0x2600, string)
from oscam-patched-old.
Great! Thank you so much for your support!
from oscam-patched-old.
Related Issues (20)
- Wrong algo dvbcsa HOT 1
- Stream Relay config -VDR ?
- Add Oscam emu? HOT 3
- Icam DE patch HOT 2
- director.c warning HOT 1
- Windows Oscam-emu patch İcam HOT 1
- Could you ADD ARM NEON in oscam.version HOT 1
- Oscam Not Work if Enable ARM NEON HOT 1
- Question about the Stream Relay Config" when creating a modified channel List
- Compiler warnings HOT 1
- Permissions HOT 15
- Possible to add modeCW 1 enhancement? HOT 4
- Possible to add PowerVu ECM nano 01? HOT 1
- User for monitor HOT 1
- ECM Key Late 100ms HOT 1
- nano01 PowerVu - TV5 HOT 2
- Oscam Emu and Biss channels HOT 3
- request powervu hash mode 44 HOT 3
- No video 3720v 58w whit keys valid HOT 7
- 44A0 56E HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oscam-patched-old.