UpdatedDecryp
Dependencies: BahlDecrypModified CyaSSL mbed nRF51822
Fork of Decryptulator by
Hashes/SlidingWindow.cpp@13:8b706583610a, 2017-05-09 (annotated)
- Committer:
- vbahl2
- Date:
- Tue May 09 03:06:55 2017 +0000
- Revision:
- 13:8b706583610a
UpdatedDecryp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vbahl2 | 13:8b706583610a | 1 | #include "SlidingWindow.h" |
vbahl2 | 13:8b706583610a | 2 | |
vbahl2 | 13:8b706583610a | 3 | |
vbahl2 | 13:8b706583610a | 4 | |
vbahl2 | 13:8b706583610a | 5 | /**Sliding Window Constructor**/ |
vbahl2 | 13:8b706583610a | 6 | SlidingWindow::SlidingWindow(void){ |
vbahl2 | 13:8b706583610a | 7 | pair<BLEProtocol::AddressBytes_t, unsigned char *> * sliding_window = new pair<BLEProtocol::AddressBytes_t, unsigned char *>[SLIDING_WINDOW_SIZE]; |
vbahl2 | 13:8b706583610a | 8 | } |
vbahl2 | 13:8b706583610a | 9 | |
vbahl2 | 13:8b706583610a | 10 | |
vbahl2 | 13:8b706583610a | 11 | |
vbahl2 | 13:8b706583610a | 12 | void SlidingWindow::populateSlidingWindow(void){ |
vbahl2 | 13:8b706583610a | 13 | |
vbahl2 | 13:8b706583610a | 14 | for(int i = 0; i < SLIDING_WINDOW_SIZE; i++){ |
vbahl2 | 13:8b706583610a | 15 | sliding_window[i] = lookupTable[(sliding_window_index + i) % LOOKUP_TABLE_SIZE]; |
vbahl2 | 13:8b706583610a | 16 | } |
vbahl2 | 13:8b706583610a | 17 | } |
vbahl2 | 13:8b706583610a | 18 | |
vbahl2 | 13:8b706583610a | 19 | void SlidingWindow::moveSlidingWindow(uint32_t offset){ |
vbahl2 | 13:8b706583610a | 20 | sliding_window+= offset; |
vbahl2 | 13:8b706583610a | 21 | } |
vbahl2 | 13:8b706583610a | 22 | |
vbahl2 | 13:8b706583610a | 23 | |
vbahl2 | 13:8b706583610a | 24 | |
vbahl2 | 13:8b706583610a | 25 | SlidingWindow::~SlidingWindow(void){ |
vbahl2 | 13:8b706583610a | 26 | clearSlidingWindow(); |
vbahl2 | 13:8b706583610a | 27 | } |
vbahl2 | 13:8b706583610a | 28 | |
vbahl2 | 13:8b706583610a | 29 | void SlidingWindow::clearSlidingWindow(void){ |
vbahl2 | 13:8b706583610a | 30 | for(int i = 0; i < SLIDING_WINDOW_SIZE; i++){ |
vbahl2 | 13:8b706583610a | 31 | delete sliding_window[i]; |
vbahl2 | 13:8b706583610a | 32 | } |
vbahl2 | 13:8b706583610a | 33 | delete sliding_window[]; |
vbahl2 | 13:8b706583610a | 34 | } |