@@ -162,22 +162,19 @@ local function _ja4(txn)
162162 -- Parse ciphers
163163 ---- --------------
164164 local ciphers = {}
165- local ciphers_orig
166- if RAW_OUTPUTS then
167- ciphers_orig = {}
168- end
165+ local cipher_list_orig = " "
169166 local cipher_bin = txn .f :ssl_fc_cipherlist_bin (1 )
170167 if cipher_bin and # cipher_bin >= 2 then
171168 local count = 0
172169 for i = 1 , # cipher_bin - 1 , 2 do
173170 count = count + 1
174171 local value = string.unpack (" >I2" , cipher_bin , i )
175172 local hex = HEX_LOOKUP [value ] or string.format (" %04x" , value )
176- if RAW_OUTPUTS then
177- ciphers_orig [count ] = hex
178- end
179173 ciphers [count ] = hex
180174 end
175+ if RAW_OUTPUTS then
176+ cipher_list_orig = table.concat (ciphers , " ," )
177+ end
181178 table.sort (ciphers )
182179 end
183180
@@ -225,9 +222,8 @@ local function _ja4(txn)
225222 local cipher_list = table.concat (ciphers , " ," )
226223 local extension_list = table.concat (extensions , " ," )
227224 local signature_algorithm_list = table.concat (signature_algorithms , " ," )
228- local cipher_list_orig , extension_list_orig
225+ local extension_list_orig
229226 if RAW_OUTPUTS then
230- cipher_list_orig = table.concat (ciphers_orig , " ," )
231227 extension_list_orig = table.concat (extensions_orig , " ," )
232228 end
233229
@@ -280,10 +276,12 @@ local function _ja4(txn)
280276
281277 if extension_list_orig == " " then
282278 ja4_c_o = " 000000000000"
279+ ja4_c_ro = " "
283280 elseif signature_algorithm_list ~= " " then
284- local hash_input = extension_list_orig .. " _" .. signature_algorithm_list
285- ja4_c_o = sha256_truncated (txn .c , hash_input )
281+ ja4_c_ro = extension_list_orig .. " _" .. signature_algorithm_list
282+ ja4_c_o = sha256_truncated (txn .c , ja4_c_ro )
286283 else
284+ ja4_c_ro = extension_list_orig
287285 ja4_c_o = sha256_truncated (txn .c , extension_list_orig )
288286 end
289287
@@ -294,14 +292,6 @@ local function _ja4(txn)
294292 else
295293 ja4_c_r = extension_list
296294 end
297-
298- if extension_list_orig == " " then
299- ja4_c_ro = " "
300- elseif signature_algorithm_list ~= " " then
301- ja4_c_ro = extension_list_orig .. " _" .. signature_algorithm_list
302- else
303- ja4_c_ro = extension_list_orig
304- end
305295 end
306296
307297 ---- ---------------------------------
0 commit comments