mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 13:45:34 +08:00
(NS2): use different encryption for keys shorter than 96 bytes.
This commit is contained in:
parent
0134583782
commit
37023024b7
@ -75,10 +75,8 @@ namespace GameRes.Formats.NScripter
|
||||
if (string.IsNullOrEmpty (password))
|
||||
return null;
|
||||
var key = Encoding.ASCII.GetBytes (password);
|
||||
if (key.Length < 96)
|
||||
throw new OperationCanceledException ("Password should be at least 96 characters long");
|
||||
|
||||
using (var input = new Ns2Stream (file, key))
|
||||
using (var input = OpenEncryptedStream (file, key))
|
||||
{
|
||||
dir = ReadIndex (input);
|
||||
if (null == dir)
|
||||
@ -132,10 +130,18 @@ namespace GameRes.Formats.NScripter
|
||||
{
|
||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
}
|
||||
var encrypted = new Ns2Stream (arc.File, nsa_arc.Key);
|
||||
var encrypted = OpenEncryptedStream (arc.File, nsa_arc.Key);
|
||||
return new StreamRegion (encrypted, entry.Offset, entry.Size);
|
||||
}
|
||||
|
||||
Stream OpenEncryptedStream (ArcView file, byte[] key)
|
||||
{
|
||||
if (key.Length < 96)
|
||||
return new EncryptedViewStream (file, key);
|
||||
else
|
||||
return new Ns2Stream (file, key);
|
||||
}
|
||||
|
||||
private string QueryPassword ()
|
||||
{
|
||||
var options = Query<NsaOptions> (arcStrings.ArcEncryptedNotice);
|
||||
@ -165,7 +171,7 @@ namespace GameRes.Formats.NScripter
|
||||
{
|
||||
byte[] m_key;
|
||||
|
||||
static readonly Cryptography.MD5 MD5 = new Cryptography.MD5();
|
||||
readonly Cryptography.MD5 MD5 = new Cryptography.MD5();
|
||||
|
||||
const int BlockSize = 32;
|
||||
|
||||
|
@ -71,6 +71,7 @@ Eiyuu x Maou<br/>
|
||||
Wasurenagusa ~Forget-me-Not~<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.gsp</td><td>-</td><td>No</td><td rowspan="2">GSD</td><td rowspan="2">
|
||||
Asanagi no Aquanauts<br/>
|
||||
I Cup Bonyuu Kangofu<br/>
|
||||
Natsuiro ☆ Communication ♪<br/>
|
||||
Saimin Gakuen<br/>
|
||||
@ -176,6 +177,8 @@ Ren'ai Jugyou ~Oshiego no Yuuwaku~<br/>
|
||||
<tr class="odd"><td>*.nsa<br/>*.sar</td><td>-</td><td>Yes<a href="#note-1" class="footnote">1</a></td><td>NScripter</td><td>
|
||||
Binary Pot<br/>
|
||||
Chou Gedou Yuusha<br/>
|
||||
Shinshoku ~Inma no Ikenie~<br/>
|
||||
Shinshoku 2 ~Inma no Ikenie~<br/>
|
||||
Tsukihime<br/>
|
||||
Umineko<br/>
|
||||
</td></tr>
|
||||
@ -490,6 +493,7 @@ Tsurugi Otome Noah<br/>
|
||||
<tr><td>*.pmp<br/>*.pmw</td><td>-</td><td>Yes</td><td>ScenePlayer</td><td>
|
||||
Eraburu ~Erabu + Love x Double de~<br/>
|
||||
Nyuujoku Hitozuma Jogakuen<br/>
|
||||
WW&F ~Taishou Teito Denkitan~<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.dat</td><td><tt>GAMEDAT PACK</tt><br/><tt>GAMEDAT PAC2</tt></td><td>No</td><td rowspan="2"> bootUP!<br/>Pajamas Soft<br/>Aries</td><td rowspan="2">
|
||||
Aneimo 2 ~Second Stage~<br/>
|
||||
@ -732,9 +736,10 @@ Majiresu!! ~Omatase Little Wing~<br/>
|
||||
</td></tr>
|
||||
<tr class="last"><td>*.arg<br/>*.argb</td><td><tt>BGRA</tt></td><td>No</td></tr>
|
||||
<tr class="odd"><td>*.pac</td><td><tt>PACK</tt></td><td>No</td><td rowspan="2">Emic</td><td rowspan="2">
|
||||
Chikan Densha Otoko ~Densetsu no Target~<br/>
|
||||
Futamajo<br/>
|
||||
</td></tr>
|
||||
<tr class="odd last"><td>*.bmp</td><td><tt>MWP</tt></td><td>No</td></tr>
|
||||
<tr class="odd last"><td>*.bmp</td><td><tt>MWP</tt><br/><tt>TEYL</tt></td><td>No</td></tr>
|
||||
<tr><td>*.dat+*l.dat</td><td>-<br/><tt>GLNK</tt></td><td>No</td><td>Studio Miris<br/>Caligula</td><td>
|
||||
Itadaki Jangarian<br/>
|
||||
Tetsuwan Gacchu!<br/>
|
||||
@ -862,6 +867,7 @@ Gakuen Saimin Reido<br/>
|
||||
</td></tr>
|
||||
<tr class="odd last"><td>*.akb</td><td><tt>AKB</tt></td><td>No</td></tr>
|
||||
<tr><td>*.cpz</td><td><tt>CPZ5</tt><br/><tt>CPZ6</tt></td><td>No</td><td rowspan="2">CMVS</td><td rowspan="2">
|
||||
Amatsutsumi<br/>
|
||||
Chrono Clock<br/>
|
||||
Hapymaher<br/>
|
||||
Haruiro Ouse<br/>
|
||||
@ -1093,8 +1099,10 @@ Denpa no Dorei<br/>
|
||||
Soushinjutsu Plus<br/>
|
||||
Soushinjutsu 2<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.ns2</td><td>-</td><td>No</td><td>NScripter</td><td>
|
||||
<tr><td>*.ns2</td><td>-</td><td>No</td><td>NScripter2</td><td>
|
||||
Rakuin Hime Runed Princess<br/>
|
||||
Shinshoku -Zero- ~Inma no Ikenie~<br/>
|
||||
Shinshoku 3 ~Inma no Ikenie~<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.dat</td><td>-</td><td>No</td><td>NekoSDK</td><td>
|
||||
Elevator Panic ~Misshitsu no Inkou~<br/>
|
||||
|
Loading…
Reference in New Issue
Block a user