Browse Source

bugfix in complement, was not padding the good amount of = signs

Nicolas Cannasse 11 năm trước cách đây
mục cha
commit
8cd3196015
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      std/haxe/crypto/Base64.hx

+ 1 - 1
std/haxe/crypto/Base64.hx

@@ -32,7 +32,7 @@ class Base64 {
 	public static function encode( bytes : haxe.io.Bytes, complement = true ) : String {
 	public static function encode( bytes : haxe.io.Bytes, complement = true ) : String {
 		var str = new BaseCode(BYTES).encodeBytes(bytes).toString();
 		var str = new BaseCode(BYTES).encodeBytes(bytes).toString();
 		if( complement )
 		if( complement )
-			for( i in 0...(bytes.length*4)%3 )
+			for( i in 0...(3-(bytes.length*4)%3)%3 )
 				str += "=";
 				str += "=";
 		return str;
 		return str;
 	}
 	}