MCPcopy Create free account
hub / github.com/Spuckwaffel/Kernel-Thread-Driver / skCrypter

Class skCrypter

Driver/skCrypter.h:58–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57 template <int _size, char _key1, char _key2, typename T>
58 class skCrypter
59 {
60 public:
61 __forceinline constexpr skCrypter(T* data)
62 {
63 crypt(data);
64 }
65
66 __forceinline T* get()
67 {
68 return _storage;
69 }
70
71 __forceinline int size() // (w)char count
72 {
73 return _size;
74 }
75
76 __forceinline char key()
77 {
78 return _key1;
79 }
80
81 __forceinline T* encrypt()
82 {
83 if (!isEncrypted())
84 crypt(_storage);
85
86 return _storage;
87 }
88
89 __forceinline T* decrypt()
90 {
91 if (isEncrypted())
92 crypt(_storage);
93
94 return _storage;
95 }
96
97 __forceinline bool isEncrypted()
98 {
99 return _storage[_size - 1] != 0;
100 }
101
102 __forceinline void clear() // set full storage to 0
103 {
104 for (int i = 0; i < _size; i++)
105 {
106 _storage[i] = 0;
107 }
108 }
109
110 __forceinline operator T* ()
111 {
112 decrypt();
113
114 return _storage;
115 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected