Skip to content

Commit c868657

Browse files
authored
refactor(watermarker): rename all variants of Trendmark from *Watermark to *Trendmark (#80)
1 parent 498449f commit c868657

File tree

6 files changed

+453
-453
lines changed

6 files changed

+453
-453
lines changed

docs/docs/Trendmark.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ watermarks that change the content itself (e.g. compression).
2323

2424
| Tag (in hex) | Class name | Meaning |
2525
| -- | -- | -- |
26-
| 00 | RawWatermark | raw bytes without special encoding |
27-
| 01 | SizedWatermark | size + raw bytes |
28-
| 02 | CRC32Watermark | CRC32 checksum + raw bytes |
29-
| 03 | SizedCRC32Watermark | size + CRC32 checksum + raw bytes |
30-
| 04 | SHA3256Watermark | SHA3-256 hash + raw bytes |
31-
| 05 | SizedSHA3256Watermark | size + SHA3-256 hash + raw bytes |
26+
| 00 | RawTrendmark | raw bytes without special encoding |
27+
| 01 | SizedTrendmark | size + raw bytes |
28+
| 02 | CRC32Trendmark | CRC32 checksum + raw bytes |
29+
| 03 | SizedCRC32Trendmark | size + CRC32 checksum + raw bytes |
30+
| 04 | SHA3256Trendmark | SHA3-256 hash + raw bytes |
31+
| 05 | SizedSHA3256Trendmark | size + SHA3-256 hash + raw bytes |
3232
| -- | -- | -- |
33-
| fe | CompressedRawWatermark | compressed bytes |
34-
| fd | CompressedSizedWatermark | size + compressed bytes |
35-
| fc | CompressedCRC32Watermark | CRC32 checksum + compressed bytes |
36-
| fb | CompressedSizedCRC32Watermark | size + CRC32 checksum + compressed bytes |
37-
| fa | CompressedSHA3256Watermark | SHA3-256 hash + compressed bytes |
38-
| f9 | CompressedSizedSHA3256Watermark | size + SHA3-256 hash + compressed bytes |
33+
| fe | CompressedRawTrendmark | compressed bytes |
34+
| fd | CompressedSizedTrendmark | size + compressed bytes |
35+
| fc | CompressedCRC32Trendmark | CRC32 checksum + compressed bytes |
36+
| fb | CompressedSizedCRC32Trendmark | size + CRC32 checksum + compressed bytes |
37+
| fa | CompressedSHA3256Trendmark | SHA3-256 hash + compressed bytes |
38+
| f9 | CompressedSizedSHA3256Trendmark | size + SHA3-256 hash + compressed bytes |
3939
| -- | -- | -- |
4040
| ff | Custom | Reserved for custom Trendmark implementations |
4141

@@ -49,59 +49,59 @@ Compressing the example watermark content results in the bytes (f3 c9 2f 4a cd 5
4949
Only the content is compressed, potentially allowing to use the additional information to increase
5050
the watermark robustness.
5151

52-
### RawWatermark
52+
### RawTrendmark
5353

5454
| tag | raw bytes |
5555
| -- | -- |
5656
| 00 | 4c 6f 72 65 6d 20 69 70 73 75 6d |
5757

58-
### SizedWatermark
58+
### SizedTrendmark
5959
The size is calculated over the entire watermark.
6060

6161
| tag | size in 32 bits little-endian | raw bytes |
6262
| -- | -- | -- |
6363
| 01 | 10 00 00 00 | 4c 6f 72 65 6d 20 69 70 73 75 6d |
6464

65-
### CRC32Watermark
65+
### CRC32Trendmark
6666
The [CRC32](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum is calculated over the
6767
entire watermark, replacing the bytes containing the checksum with null bytes.
6868

6969
| tag | CRC32 checksum little-endian | raw bytes |
7070
| -- | -- | -- |
7171
| 02 | 87 0b 16 35 | 4c 6f 72 65 6d 20 49 70 73 75 6d |
7272

73-
### SizedCRC32Watermark
73+
### SizedCRC32Trendmark
7474
The size and CRC32 checksum are calculated over the entire watermark, replacing the bytes containing
7575
the checksum with null bytes.
7676

7777
| tag | size in 32 bits little-endian | CRC32 checksum little-endian | raw bytes |
7878
| -- | -- | -- | -- |
7979
| 03 | 14 00 00 00 | 1e 85 5b 04 | 4c 6f 72 65 6d 20 49 70 73 75 6d |
8080

81-
### SHA3256Watermark
81+
### SHA3256Trendmark
8282
The [SHA3-256](https://en.wikipedia.org/wiki/SHA-3) hash is calculated over the entire watermark,
8383
replacing the bytes containing the hash with null bytes.
8484

8585
| tag | SHA3-256 hash | raw bytes |
8686
| -- | -- | -- |
8787
| 04 | de 02 65 dd 6b 16 a0 b4 ab 05 a4 39 36 c0 73 12 4f 66 a2 aa 55 b3 9c 2b 30 b6 19 de 1c 11 c9 50 | 4c 6f 72 65 6d 20 49 70 73 75 6d |
8888

89-
### SizedSHA3256Watermark
89+
### SizedSHA3256Trendmark
9090
The size and SHA3-256 hash are calculated over the entire watermark, replacing the bytes containing the
9191
hash are replaced with zero-bytes.
9292

9393
| tag | size in 32 bits little-endian | SHA3-256 hash | raw bytes |
9494
| -- | -- | -- | -- |
9595
| 05 | 30 00 00 00 | f2 17 a5 ae 43 c5 70 a2 33 2b b5 90 60 23 45 da 6d 35 d3 34 95 5c 17 83 ec ec 2e 49 66 45 c9 1a | 4c 6f 72 65 6d 20 49 70 73 75 6d |
9696

97-
### CompressedRawWatermark
97+
### CompressedRawTrendmark
9898
Trendmark uses DEFLATE as compression algorithm (see RFC 1951).
9999

100100
| tag | compressed content |
101101
| -- | -- |
102102
| fe | f3 c9 2f 4a cd 55 f0 2c 28 2e cd 05 00 |
103103

104-
### CompressedSizedWatermark
104+
### CompressedSizedTrendmark
105105
The size is calculated over the entire watermark.
106106
Only the content is compressed, potentially allowing to use the additional information to increase
107107
the watermark robustness.
@@ -112,7 +112,7 @@ Trendmark uses [DEFLATE](https://en.wikipedia.org/wiki/Deflate) as compression a
112112
| -- | -- | -- |
113113
| fd | 12 00 00 00 | f3 c9 2f 4a cd 55 f0 2c 28 2e cd 05 00 |
114114

115-
### CompressedCRC32Watermark
115+
### CompressedCRC32Trendmark
116116
The CRC32 checksum is calculated over the entire watermark, replacing the bytes containing the
117117
checksum with null bytes.
118118
Only the content is compressed, potentially allowing to use the additional information to increase
@@ -123,7 +123,7 @@ Trendmark uses DEFLATE as compression algorithm (see RFC 1951).
123123
| -- | -- | -- |
124124
| fc | 9d 54 46 ff | f3 c9 2f 4a cd 55 f0 2c 28 2e cd 05 00 |
125125

126-
### CompressedSizedCRC32Watermark
126+
### CompressedSizedCRC32Trendmark
127127
The size and CRC32 checksum are calculated over the entire watermark, replacing the bytes containing
128128
the checksum with null bytes.
129129
Only the content is compressed, potentially allowing to use the additional information to increase
@@ -134,7 +134,7 @@ Trendmark uses DEFLATE as compression algorithm (see RFC 1951).
134134
| -- | -- | -- | -- |
135135
| fb | 16 00 00 00 | 13 07 a7 d2 | f3 c9 2f 4a cd 55 f0 2c 28 2e cd 05 00 |
136136

137-
### CompressedSHA3256Watermark
137+
### CompressedSHA3256Trendmark
138138
The SHA3-256 hash is calculated over the entire watermark, replacing the bytes containing the hash
139139
with null bytes.
140140
Only the content is compressed, potentially allowing to use the additional information to increase
@@ -145,7 +145,7 @@ Trendmark uses DEFLATE as compression algorithm (see RFC 1951).
145145
| -- | -- | -- |
146146
| fa | df 60 19 45 c2 77 98 5d 0e 59 cc f8 9b 27 ed 9f 9c 98 85 a5 b3 3e c7 47 fa 88 68 74 a8 ef 77 5b | f3 c9 2f 4a cd 55 f0 2c 28 2e cd 05 00 |
147147

148-
### CompressedSizedSHA3256Watermark
148+
### CompressedSizedSHA3256Trendmark
149149
The size and SHA3-256 hash are calculated over the entire watermark, replacing the bytes containing the
150150
hash are replaced with zero-bytes.
151151
Only the content is compressed, potentially allowing to use the additional information to increase

watermarker/src/commonMain/kotlin/watermarks/TextWatermark.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,20 @@ class TextWatermark private constructor(
8585

8686
val textWatermark =
8787
when (trendmark) {
88-
is RawWatermark -> TextWatermark(text)
89-
is SizedWatermark -> TextWatermark(text, sized = true)
90-
is CompressedRawWatermark -> TextWatermark(text, compressed = true)
91-
is CompressedSizedWatermark ->
88+
is RawTrendmark -> TextWatermark(text)
89+
is SizedTrendmark -> TextWatermark(text, sized = true)
90+
is CompressedRawTrendmark -> TextWatermark(text, compressed = true)
91+
is CompressedSizedTrendmark ->
9292
TextWatermark(text, compressed = true, sized = true)
9393

94-
is CRC32Watermark,
95-
is SizedCRC32Watermark,
96-
is CompressedCRC32Watermark,
97-
is CompressedSizedCRC32Watermark,
98-
is SHA3256Watermark,
99-
is SizedSHA3256Watermark,
100-
is CompressedSHA3256Watermark,
101-
is CompressedSizedSHA3256Watermark,
94+
is CRC32Trendmark,
95+
is SizedCRC32Trendmark,
96+
is CompressedCRC32Trendmark,
97+
is CompressedSizedCRC32Trendmark,
98+
is SHA3256Trendmark,
99+
is SizedSHA3256Trendmark,
100+
is CompressedSHA3256Trendmark,
101+
is CompressedSizedSHA3256Trendmark,
102102
-> {
103103
status.addEvent(UnsupportedTrendmarkError(trendmark.getSource()))
104104
return status.into<_>()
@@ -136,13 +136,13 @@ class TextWatermark private constructor(
136136
val content = text.encodeToByteArray().asList()
137137

138138
return if (sized && compressed) {
139-
CompressedSizedWatermark.new(content)
139+
CompressedSizedTrendmark.new(content)
140140
} else if (sized) {
141-
SizedWatermark.new(content)
141+
SizedTrendmark.new(content)
142142
} else if (compressed) {
143-
CompressedRawWatermark.new(content)
143+
CompressedRawTrendmark.new(content)
144144
} else {
145-
RawWatermark.new(content)
145+
RawTrendmark.new(content)
146146
}
147147
}
148148

0 commit comments

Comments
 (0)