MIKAI
Library to modify content of a Mykey
mikai.h
Go to the documentation of this file.
1 /*
2  * @author Lilz <https://telegram.me/Lilz73>
3  * @copyright 2020-2021 Lilz <https://telegram.me/Lilz73>
4  * @license MIKAI X License
5  *
6  * This file is part of MIKAI X.
7  *
8  * MIKAI X is free software: you can redistribute it and/or modify
9  * it under the terms of the MIKAI X License, as published by
10  * Lilz along with this program and available on "MIKAI X Download" Telegram channel
11  * <https://telegram.me/mikaidownload>.
12  *
13  * MIKAI X is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY.
15  *
16  * You should have received a copy of the MIKAI X License along
17  * with MIKAI X.
18  * If not, see <https://telegram.me/mikaidownload>.
19  */
20 
21 #ifndef MIKAI_MIKAI_H
22 #define MIKAI_MIKAI_H
23 
24 #include <stdbool.h>
25 #include <stdint.h>
26 #include <mikai/mikai-reader.h>
27 
28 #define SRIX_BLOCK_LENGTH 4
29 #define SRIX_UID_LENGTH 8
30 #define SRIX4K_BLOCKS 128
31 #define SRIX4K_BYTES 512
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36 
41 MIKAI_EXPORT const char *MikaiVersion();
42 
48 
56 MIKAI_EXPORT const char *MikaiInit(MyKey **target, uint32_t dump[const SRIX4K_BLOCKS], uint64_t selection);
57 
62 MIKAI_EXPORT void MikaiDelete(MyKey *key);
63 
69 MIKAI_EXPORT const char *MikaiGetLatestError(MyKey *key);
70 
77 
84 
91 
92 
99 MIKAI_EXPORT uint32_t MyKeyGetBlock(MyKey *key, uint8_t blockNum);
100 
107 MIKAI_EXPORT void MyKeyModifyBlock(MyKey *key, uint32_t block, uint8_t blockNum);
108 
114 MIKAI_EXPORT void MyKeyImportVendor(MyKey *key, uint32_t vendor);
115 
122 MIKAI_EXPORT int MyKeyExportVendor(MyKey *key, uint32_t *vendor);
123 
130 MIKAI_EXPORT void MyKeyExportMemory(MyKey *key, uint32_t dump[const SRIX4K_BLOCKS], uint64_t *uid);
131 
136 MIKAI_EXPORT void MyKeyReset(MyKey *key);
137 
144 
154 MIKAI_EXPORT int MyKeyAddCents(MyKey *key, uint16_t cents, uint8_t day, uint8_t month, uint8_t year);
155 
165 MIKAI_EXPORT int MyKeySetCents(MyKey *key, uint16_t cents, uint8_t day, uint8_t month, uint8_t year);
166 
167 #ifdef __cplusplus
168 }
169 #endif /* __cplusplus */
170 #endif /* MIKAI_MIKAI_H */
MyKeyCheckLockID
MIKAI_EXPORT bool MyKeyCheckLockID(MyKey *key)
Return true if MyKey has lock id and checksum of credit is wrong.
MyKeyReset
MIKAI_EXPORT void MyKeyReset(MyKey *key)
Reset a MyKey to associate it with another vendor.
mikai-reader.h
MyKeyExportMemory
MIKAI_EXPORT void MyKeyExportMemory(MyKey *key, uint32_t dump[const 128], uint64_t *uid)
Export SRIX data to specified memory locations.
MikaiGetLatestError
const MIKAI_EXPORT char * MikaiGetLatestError(MyKey *key)
Get a text description of latest error occured and reset it.
MyKeyGetCurrentCredit
MIKAI_EXPORT uint16_t MyKeyGetCurrentCredit(MyKey *key)
Extract current credit from block 21.
MyKey
Struct that represents a MyKey.
Definition: mikai-internal.h:31
MyKeyAddCents
MIKAI_EXPORT int MyKeyAddCents(MyKey *key, uint16_t cents, uint8_t day, uint8_t month, uint8_t year)
Add N cents to MyKey actual credit.
MikaiDelete
MIKAI_EXPORT void MikaiDelete(MyKey *key)
Delete a MyKey.
Definition: mikai.c:86
MyKeyGetEncryptionKey
MIKAI_EXPORT uint32_t MyKeyGetEncryptionKey(MyKey *key)
Get MyKey encryption key.
MikaiVersion
const MIKAI_EXPORT char * MikaiVersion()
Get current version of mikai as string.
Definition: mikai.c:26
MIKAI_EXPORT
#define MIKAI_EXPORT
Definition: mikai-reader.h:35
MikaiNew
MIKAI_EXPORT MyKey * MikaiNew()
Create a new MyKey instance.
Definition: mikai.c:30
MyKeySetCents
MIKAI_EXPORT int MyKeySetCents(MyKey *key, uint16_t cents, uint8_t day, uint8_t month, uint8_t year)
Reset credit history and charge N cents.
SRIX4K_BLOCKS
#define SRIX4K_BLOCKS
Definition: mikai.h:30
MyKeyImportVendor
MIKAI_EXPORT void MyKeyImportVendor(MyKey *key, uint32_t vendor)
Import vendor code and recalculate encryption key.
MikaiInit
const MIKAI_EXPORT char * MikaiInit(MyKey **target, uint32_t dump[const 128], uint64_t selection)
Initialize a MyKey.
MyKeyGetBlock
MIKAI_EXPORT uint32_t MyKeyGetBlock(MyKey *key, uint8_t blockNum)
Get the value of a specific block.
MyKeyIsReset
MIKAI_EXPORT bool MyKeyIsReset(MyKey *key)
Check if a MyKey is reset (if it hasn't an associated vendor code).
Definition: mykey.c:131
MyKeyExportVendor
MIKAI_EXPORT int MyKeyExportVendor(MyKey *key, uint32_t *vendor)
Decrypt vendor code and save it to vendor pointer.
MyKeyModifyBlock
MIKAI_EXPORT void MyKeyModifyBlock(MyKey *key, uint32_t block, uint8_t blockNum)
Modify a MyKey block manually.