Показать сообщение отдельно

  #5  
Старый 14.10.2024, 10:58
MrKirill1232
Флудер
Регистрация: 31.10.2018
Сообщений: 2,776
С нами: 3966734

Репутация: 1904


По умолчанию

Цитата:
Сообщение от BIT_hack  

Я пробовал и так и так и в разных языках программирования но у меня все равно остаются нулевые байты(
Java:


Код:
public
final
static
String
LINEAGE_2_HEADER
=
"Lineage2Ver"
;
public
final
static
int
LINEAGE_2_HEADER_SIZE
=
(
LINEAGE_2_HEADER
.
length
(
)
*
2
)
+
(
3
*
2
)
;
private
CommonPair

getCryptVersion
(
File
inputFile
)
{
byte
[
]
headerAsBytes
=
readHeader
(
inputFile
)
;
if
(
headerAsBytes
.
length
==
0
)
{
return
null
;
}
final
String
headerAsString
=
new
String
(
headerAsBytes
,
StandardCharsets
.
UTF_16LE
)
;
if
(
headerAsString
.
startsWith
(
LINEAGE_2_HEADER
)
)
{
int
cryptVersion
=
Integer
.
parseInt
(
headerAsString
.
substring
(
LINEAGE_2_HEADER
.
length
(
)
)
)
;
if
(
!
(
cryptVersion
==
111
||
cryptVersion
==
121
)
)
{
return
null
;
}
switch
(
cryptVersion
)
{
case
111
:
{
return
new
CommonPair
<>
(
cryptVersion
,
-
1397969748
)
;
}
case
121
:
{
String
filename
=
getFileName
(
)
.
toLowerCase
(
Locale
.
ROOT
)
;
//_fileName.split("\\.")[_fileName.split("\\.").length - 1];
int
xor
=
0
;
for
(
int
index
=
0
;
index

(
cryptVersion
,
xor
)
;
}
}
}
return
null
;
}
Даже такой "жутко-код" выполнял свои функции.
 
Ответить с цитированием