@@ -13,9 +13,9 @@ import 'package:ffi/ffi.dart';
13
13
/// This method is used in the [getHash] method and maps to the Dart method [_Argon2Hash] .
14
14
///
15
15
/// This method returns an [Int32] which maps to a Dart [int] for the error/result code.
16
- typedef _argon2_hash = Int32 Function (
17
- Uint32 t_cost ,
18
- Uint32 m_cost ,
16
+ typedef _CArgon2Hash = Int32 Function (
17
+ Uint32 tCost ,
18
+ Uint32 mCost ,
19
19
Uint32 parallelism,
20
20
Pointer <Uint8 > pwd,
21
21
IntPtr pwdlen,
@@ -29,7 +29,7 @@ typedef _argon2_hash = Int32 Function(
29
29
Uint32 version,
30
30
);
31
31
32
- /// The Dart function definition for [_argon2_hash ] , and is used to bind the C types
32
+ /// The Dart function definition for [_CArgon2Hash ] , and is used to bind the C types
33
33
/// to given Dart inputs.
34
34
///
35
35
/// All parameters are named in symmetry with the C library's name. [t_cost] refers to the
@@ -44,8 +44,8 @@ typedef _argon2_hash = Int32 Function(
44
44
/// Returns an [int] with the result code for the hash, while the real raw hash & encoded hashes
45
45
/// are written to the [hash] and [encoded] pointers respectively.
46
46
typedef _Argon2Hash = int Function (
47
- int t_cost ,
48
- int m_cost ,
47
+ int tCost ,
48
+ int mCost ,
49
49
int parallelism,
50
50
Pointer <Uint8 > pwd,
51
51
int pwdlen,
@@ -64,14 +64,14 @@ typedef _Argon2Hash = int Function(
64
64
/// This method is used in the [verifyHash] method and maps to the Dart method [_Argon2Verify] .
65
65
///
66
66
/// This method returns an [Int32] which maps to a Dart [int] for the true/false output.
67
- typedef _argon2_verify = Int32 Function (
67
+ typedef _CArgon2Verify = Int32 Function (
68
68
Pointer <Utf8 > encoded,
69
69
Pointer <Uint8 > pwd,
70
70
IntPtr pwdlen,
71
71
Uint32 type,
72
72
);
73
73
74
- /// The Dart function definition for [_argon2_verify ] , and is used to bind the C types
74
+ /// The Dart function definition for [_CArgon2Verify ] , and is used to bind the C types
75
75
/// to given Dart inputs.
76
76
///
77
77
/// All parameters are named in symmetry with the C library's name. [pwd] is a [Uint8] pointer for the password byte. [pwdlen] refers to the length
@@ -88,10 +88,10 @@ typedef _Argon2Verify = int Function(
88
88
/// This method is used in the [getEncodedHashLength] method and maps to the Dart method [_Argon2Encodedlen] .
89
89
///
90
90
/// This method returns an [IntPtr] which maps to a Dart [int] for the length of the encoded hash
91
- typedef _argon2_encodedlen = IntPtr Function (Uint32 t_cost , Uint32 m_cost ,
91
+ typedef _CArgon2Encodedlen = IntPtr Function (Uint32 tCost , Uint32 mCost ,
92
92
Uint32 parallelism, Uint32 saltlen, Uint32 hashlen, Uint32 type);
93
93
94
- /// The Dart function definition for [_argon2_encodedlen ] , and is used to bind the C types
94
+ /// The Dart function definition for [_CArgon2Encodedlen ] , and is used to bind the C types
95
95
/// to given Dart inputs.
96
96
///
97
97
/// All parameters are named in symmetry with the C library's name. [t_cost] refers to the iteration
@@ -100,24 +100,24 @@ typedef _argon2_encodedlen = IntPtr Function(Uint32 t_cost, Uint32 m_cost,
100
100
/// refers to the Argon2 Hash Type (i, d, or id).
101
101
///
102
102
/// Returns an [int] , signifying the length of the encoded hash.
103
- typedef _Argon2Encodedlen = int Function (int t_cost, int m_cost,
104
- int parallelism, int saltlen, int hashlen, int type);
103
+ typedef _Argon2Encodedlen = int Function (
104
+ int tCost, int mCost, int parallelism, int saltlen, int hashlen, int type);
105
105
106
106
/// A function definition for the Argon2 error message getter. This method will map to the
107
107
/// one in the C library, passing the necessary values to the C library via dart:ffi.
108
108
/// This method is used in the [getErrorMessage] method and maps to the Dart method [_Argon2ErrorMessage] .
109
109
///
110
110
/// This method returns an [Int32] which maps to a Dart [int] for the length of the encoded hash
111
- typedef _argon2_error_message = Pointer <Utf8 > Function (Int32 error_code );
111
+ typedef _CArgon2ErrorMessage = Pointer <Utf8 > Function (Int32 errorCode );
112
112
113
- /// The Dart function definition for [_argon2_error_message ] , and is used to bind the C types
113
+ /// The Dart function definition for [_CArgon2ErrorMessage ] , and is used to bind the C types
114
114
/// to given Dart inputs.
115
115
///
116
116
/// All parameters are named in symmetry with the C library's name. [error_code] refers to the
117
117
/// error code that we are getting the message for.
118
118
///
119
119
/// Returns an [Pointer] of type [Utf8] , signifying the error message string.
120
- typedef _Argon2ErrorMessage = Pointer <Utf8 > Function (int error_code );
120
+ typedef _Argon2ErrorMessage = Pointer <Utf8 > Function (int errorCode );
121
121
122
122
/// The main class to handle communication between the C methods and their Dart bindings.
123
123
/// Unless users are working on a low level and need to directly change the bindings or paths,
@@ -129,16 +129,16 @@ class LocalBinder {
129
129
static void initialize (LibLoader libLoader) =>
130
130
_privateInstance = LocalBinder ._(libLoader);
131
131
132
- /// Callable method of type [_Argon2Hash] that binds to [_argon2_hash ] .
132
+ /// Callable method of type [_Argon2Hash] that binds to [_CArgon2Hash ] .
133
133
late _Argon2Hash getHash;
134
134
135
- /// Callable method of type [_Argon2Verify] that binds to [_argon2_verify ] .
135
+ /// Callable method of type [_Argon2Verify] that binds to [_CArgon2Verify ] .
136
136
late _Argon2Verify verifyHash;
137
137
138
- /// Callable method of type [_Argon2Encodedlen] that binds to [_argon2_encodedlen ] .
138
+ /// Callable method of type [_Argon2Encodedlen] that binds to [_CArgon2Encodedlen ] .
139
139
late _Argon2Encodedlen getEncodedHashLength;
140
140
141
- /// Callable method of type [_Argon2ErrorMessage] that binds to [_argon2_error_message ] .
141
+ /// Callable method of type [_Argon2ErrorMessage] that binds to [_CArgon2ErrorMessage ] .
142
142
late _Argon2ErrorMessage getErrorMessage;
143
143
144
144
/// The getter for the main instance, which returns the private instance if set correctly.
@@ -154,16 +154,16 @@ class LocalBinder {
154
154
LocalBinder ._(LibLoader libLoader) {
155
155
var argon2lib = libLoader.loadLib ();
156
156
getHash = argon2lib
157
- .lookup <NativeFunction <_argon2_hash >>('argon2_hash' )
157
+ .lookup <NativeFunction <_CArgon2Hash >>('argon2_hash' )
158
158
.asFunction <_Argon2Hash >();
159
159
verifyHash = argon2lib
160
- .lookup <NativeFunction <_argon2_verify >>('argon2_verify' )
160
+ .lookup <NativeFunction <_CArgon2Verify >>('argon2_verify' )
161
161
.asFunction <_Argon2Verify >();
162
162
getEncodedHashLength = argon2lib
163
- .lookup <NativeFunction <_argon2_encodedlen >>('argon2_encodedlen' )
163
+ .lookup <NativeFunction <_CArgon2Encodedlen >>('argon2_encodedlen' )
164
164
.asFunction <_Argon2Encodedlen >();
165
165
getErrorMessage = argon2lib
166
- .lookup <NativeFunction <_argon2_error_message >>('argon2_error_message' )
166
+ .lookup <NativeFunction <_CArgon2ErrorMessage >>('argon2_error_message' )
167
167
.asFunction <_Argon2ErrorMessage >();
168
168
}
169
169
}
0 commit comments