Skip to content

Commit b8bbe29

Browse files
committed
Add clarification to Homework 02 assignment
1 parent 4854d61 commit b8bbe29

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

homeworks/02-spacescanner/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ public interface SpaceScannerAPI {
149149
/**
150150
* Saves the name of the most reliable rocket in a given time period in an encrypted format.
151151
*
152-
* @param outputStream the output stream where the encrypted result is written into
152+
* <p><b>Important:</b> The implementation is expected to wrap {@code outputStream} in a
153+
* {@link javax.crypto.CipherOutputStream}. Since block ciphers (e.g. AES) write the final block
154+
* only on {@code close()}, this method <b>must close</b> the stream after writing.
155+
*
156+
* @param outputStream the output stream where the encrypted result is written into;
157+
* it will be closed by this method
153158
* @param from the inclusive beginning of the time frame
154159
* @param to the inclusive end of the time frame
155160
* @throws IllegalArgumentException if outputStream, from or to is null
@@ -250,7 +255,14 @@ Reliability-то на дадена ракета ще пресмятаме по
250255
> Пример: Ракета с 3 успешни мисии и 1 неуспешна:
251256
> Reliability = (2*3 + 1) / (2*4) = 7/8 = 0.875
252257
253-
Алгоритъмът за криптиране (**AES**) има имплементация в JDK-то (в `javax.crypto` пакета) и за него сме ви дали [code snippet](https://github.com/fmi/java-course/blob/master/07-io-streams-and-files/snippets/src/bg/sofia/uni/fmi/mjt/io/CipherExample.java). Създайте клас **Rijndael**, който има следния конструктор:
258+
Алгоритъмът за криптиране (**AES**) има имплементация в JDK-то (в `javax.crypto` пакета) и за него сме ви дали [code snippet](https://github.com/fmi/java-course/blob/master/07-io-streams-and-files/snippets/src/bg/sofia/uni/fmi/mjt/io/CipherExample.java).
259+
260+
:warning: Забележка:
261+
В метода `saveMostReliableRocket(...)` се очаква използване на `CipherOutputStream`. Поради това
262+
имплементацията трябва да затвори подадения `OutputStream`, тъй като при AES последният блок
263+
се записва едва при `close()`.
264+
265+
Създайте клас **Rijndael**, който има следния конструктор:
254266

255267
```java
256268
/**

0 commit comments

Comments
 (0)