Skip to content

Commit 043500f

Browse files
- correção de merge do git
1 parent 9821500 commit 043500f

3 files changed

Lines changed: 29 additions & 52 deletions

File tree

src/base/RALConsts.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ interface
1313

1414
const
1515
// Versionamento
16-
RALVERSION = '0.12.3-1 beta';
16+
RALVERSION = '0.12.4-1 beta';
1717
RALVERSION_MAJOR = 0;
1818
RALVERSION_MINOR = 12;
19-
RALVERSION_PATCH = 3;
19+
RALVERSION_PATCH = 4;
2020
RALVERSION_FULL = RALVERSION_MAJOR * 10000
2121
+ RALVERSION_MINOR * 100
2222
+ RALVERSION_PATCH;

src/utils/RALCripto.pas

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// Unit that stores cryptographic functions used in PascalRAL
1+
/// Unit that stores cryptographic functions used in PascalRAL
22
unit RALCripto;
33

44
interface
@@ -73,89 +73,70 @@ procedure TRALCripto.SetKey(const AValue: StringRAL);
7373

7474
function TRALCripto.Encrypt(const AValue: StringRAL; ABinary : boolean): StringRAL;
7575
var
76-
vInputStream: TStringStream;
76+
vStream: TStream;
7777
begin
78-
<<<<<<< HEAD
7978
if ABinary then
8079
vStream := StringToStream(AValue)
8180
else
8281
vStream := StringToStreamUTF8(AValue);
8382

84-
=======
85-
{ TODO -cCompatibilidade : Melhorar esse código pra compatibilizar com versões antigas do Delphi }
86-
vInputStream := nil;
87-
>>>>>>> 37ded8a62a3bb2216bf3ebab8873cede96fc7d8d
8883
try
89-
vInputStream := TStringStream.Create(AValue, TEncoding.UTF8);
90-
vInputStream.Position := 0;
91-
Result := Encrypt(vInputStream);
84+
vStream.Position := 0;
85+
Result := Encrypt(vStream);
9286
finally
93-
FreeAndNil(vInputStream);
87+
FreeAndNil(vStream);
9488
end;
9589
end;
9690

9791
function TRALCripto.Decrypt(const AValue: StringRAL; ABinary : boolean): StringRAL;
9892
var
99-
vInputStream: TStringStream;
93+
vStream: TStream;
10094
begin
101-
<<<<<<< HEAD
95+
if AValue = '' then
96+
raise Exception.Create(emHMACEmptyText);
97+
10298
if ABinary then
10399
vStream := StringToStream(AValue)
104100
else
105101
vStream := StringToStreamUTF8(AValue);
106102

107-
=======
108-
{ TODO -cCompatibilidade : Melhorar esse código pra compatibilizar com versões antigas do Delphi }
109-
if AValue = '' then
110-
Raise Exception.Create(emHMACEmptyText);
111-
112-
vInputStream := nil;
113-
>>>>>>> 37ded8a62a3bb2216bf3ebab8873cede96fc7d8d
114103
try
115-
{$IFDEF FPC}
116-
vInputStream := TStringStream.Create(TRALBase64.Decode(AValue), TEncoding.UTF8);
117-
{$ELSE}
118-
vInputStream := TStringStream.Create(TRALBase64.Decode(AValue), TEncoding.ANSI);
119-
{$ENDIF}
120-
vInputStream.Position := 0;
121-
Result := Decrypt(vInputStream);
104+
vStream.Position := 0;
105+
Result := Decrypt(vStream);
122106
finally
123-
FreeAndNil(vInputStream);
107+
FreeAndNil(vStream);
124108
end;
125109
end;
126110

127111
function TRALCripto.Encrypt(AValue: TStream): StringRAL;
128112
var
129-
vEncryptedStream: TStream;
113+
vStream: TStream;
130114
begin
131115
{ TODO -cCompatibilidade : Melhorar esse código pra compatibilizar com versões antigas do Delphi }
132-
vEncryptedStream := nil;
116+
vStream := nil;
133117
try
134-
vEncryptedStream := EncryptAsStream(AValue);
135-
vEncryptedStream.Position := 0;
136-
Result := TRALBase64.Encode(vEncryptedStream);
118+
vStream := EncryptAsStream(AValue);
119+
vStream.Position := 0;
120+
121+
Result := TRALBase64.Encode(vStream);
137122
finally
138-
FreeAndNil(vEncryptedStream);
123+
FreeAndNil(vStream);
139124
end;
140125
end;
141126

142127
function TRALCripto.Decrypt(AValue: TStream): StringRAL;
143128
var
144-
vDecryptedStream: TStream;
145-
vStringStream: TStringStream;
129+
vStream: TStream;
146130
begin
147131
{ TODO -cCompatibilidade : Melhorar esse código pra compatibilizar com versões antigas do Delphi }
148-
vDecryptedStream := nil;
149-
vStringStream := nil;
132+
vStream := nil;
150133
try
151-
vDecryptedStream := DecryptAsStream(AValue);
152-
vStringStream := TStringStream.Create('', TEncoding.UTF8);
153-
vDecryptedStream.Position := 0;
154-
vStringStream.LoadFromStream(vDecryptedStream);
155-
Result := vStringStream.DataString;
134+
vStream := DecryptAsStream(AValue);
135+
vStream.Position := 0;
136+
137+
Result := StreamToString(vStream);
156138
finally
157-
FreeAndNil(vStringStream);
158-
FreeAndNil(vDecryptedStream);
139+
FreeAndNil(vStream);
159140
end;
160141
end;
161142

src/utils/RALCriptoAES.pas

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
<<<<<<< HEAD
2-
/// Unit for AES Criptography functions
3-
/// AES EBC (Sem IV)
4-
=======
51
/// Unit for AES Criptography functions
6-
>>>>>>> 37ded8a62a3bb2216bf3ebab8873cede96fc7d8d
2+
/// AES EBC (Sem IV)
73
unit RALCriptoAES;
84

95
{$I ..\base\PascalRAL.inc}

0 commit comments

Comments
 (0)