-
Notifications
You must be signed in to change notification settings - Fork 9
/
base64_test.xsl
85 lines (85 loc) · 5.79 KB
/
base64_test.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b64="https://github.com/ilyakharlamov/xslt_base64"
version="1.0">
<xsl:output method="text"/>
<xsl:include href="base64.xsl"/>
<xsl:template match="/">
<xsl:text>
--Simple decode english text from base64 (basic function) </xsl:text>
<xsl:text>
decoded is equal hello_dude-awesome.ru? </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLnJ1'"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Simple decode russain text from base64 (new function) </xsl:text>
<xsl:text>
decoded is equal приве-т.рф? </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'0L/RgNC40LLQtS3Rgi7RgNGE'"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Testing mixing text with == at the end of hash and english letter at the end of original text</xsl:text>
<xsl:text>
decoded is equal hello_dude-awesome-какой-то текст здесьdsfdsf.рфdsf (==) </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLdC60LDQutC+0Lkt0YLQviDRgtC10LrRgdGCINC30LTQtdGB0Yxkc2Zkc2Yu0YDRhGRzZg=='"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Testing mixing text with == at the end of hash and russian letter at the end of original text</xsl:text>
<xsl:text>
decoded is equal hello_dude-awesome-какой-то текст здесьdsfdsf.рф (==) </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLdC60LDQutC+0Lkt0YLQviDRgtC10LrRgdGCINC30LTQtdGB0Yxkc2Zkc2Yu0YDRhA=='"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Testing mixing text with = at the end of hash and english letter at the end of original text</xsl:text>
<xsl:text>
decoded is equal hello_dude-awesome-какой-то текст здесьdsfdsf.рфdsfd (=) </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLdC60LDQutC+0Lkt0YLQviDRgtC10LrRgdGCINC30LTQtdGB0Yxkc2Zkc2Yu0YDRhGRzZmQ='"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Testing mixing text with = at the end of hash and russian letter at the end of original text</xsl:text>
<xsl:text>
decoded is equal hello_dude-awesome-какой-то текст здесьdsfdsf.рфdsfdвам (=) </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLdC60LDQutC+0Lkt0YLQviDRgtC10LrRgdGCINC30LTQtdGB0Yxkc2Zkc2Yu0YDRhGRzZmTQstCw0Lw='"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Testing mixing text with == at the end of hash, russain letter at begining and at the end of original text</xsl:text>
<xsl:text>
decoded is equal вhello_dude-awesome-какой-то текст здесьdsfdsf.рфdsfdвам (==) </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'0LJoZWxsb19kdWRlLWF3ZXNvbWUt0LrQsNC60L7QuS3RgtC+INGC0LXQutGB0YIg0LfQtNC10YHRjGRzZmRzZi7RgNGEZHNmZNCy0LDQvA=='"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
--Simple mixed text encoding (basic function)</xsl:text>
<xsl:text>
encoding 0LJoZWxsb19kdWRlLWF3ZXNvbWUt0LrQsNC60L7QuS3RgtC+INGC0LXQutGB0YIg0LfQtNC10YHRjGRzZmRzZi7RgNGEZHNmZNCy0LDQvA== </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'вhello_dude-awesome-какой-то текст здесьdsfdsf.рфdsfdвам'"></xsl:with-param>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:text>
=================ORIGINAL TESTS=================</xsl:text>
<xsl:text>
encoded Man is </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'Man'"/>
</xsl:call-template>
<xsl:text>
encoded 1 with padding is </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'1'"/>
</xsl:call-template>
<xsl:text>
encoded 1 without padding is </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'1'"/>
<xsl:with-param name="padding" select="false()"/>
</xsl:call-template>
<xsl:text>
encoded ..a?<>???!????? as regular is </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'..a?<>???!?????'"/>
</xsl:call-template>
<xsl:text>
encoded ..a?<>???!????? as urlsafe is </xsl:text>
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="'..a?<>???!?????'"/>
<xsl:with-param name="urlsafe" select="true()"/>
</xsl:call-template>
<xsl:text>
decoded MQ== is </xsl:text>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="'MQ=='"></xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>