This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Note: this is for scrypt implementation, which doesn't use diagonal constants, | |
| // so the order of loading from x is different than in normal Salsa20 implementation. | |
| function salsa20_8(x) { | |
| var j0 = (x[ 0] & 0xff) | ((x[ 1] & 0xff)<<8) | ((x[ 2] & 0xff)<<16) | ((x[ 3] & 0xff)<<24); | |
| var j1 = (x[ 4] & 0xff) | ((x[ 5] & 0xff)<<8) | ((x[ 6] & 0xff)<<16) | ((x[ 7] & 0xff)<<24); | |
| var j2 = (x[ 8] & 0xff) | ((x[ 9] & 0xff)<<8) | ((x[10] & 0xff)<<16) | ((x[11] & 0xff)<<24); | |
| var j3 = (x[12] & 0xff) | ((x[13] & 0xff)<<8) | ((x[14] & 0xff)<<16) | ((x[15] & 0xff)<<24); | |
| var j4 = (x[16] & 0xff) | ((x[17] & 0xff)<<8) | ((x[18] & 0xff)<<16) | ((x[19] & 0xff)<<24); | |
| var j5 = (x[20] & 0xff) | ((x[21] & 0xff)<<8) | ((x[22] & 0xff)<<16) | ((x[23] & 0xff)<<24); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [[[ Speed Tests ]]] | |
| Bulk speed test - 262144-byte keys | |
| Alignment 0 - 0.925 bytes/cycle - 2646.33 MiB/sec @ 3 ghz | |
| Alignment 1 - 0.813 bytes/cycle - 2325.74 MiB/sec @ 3 ghz | |
| Alignment 2 - 0.813 bytes/cycle - 2325.73 MiB/sec @ 3 ghz | |
| Alignment 3 - 0.813 bytes/cycle - 2325.73 MiB/sec @ 3 ghz | |
| Alignment 4 - 0.813 bytes/cycle - 2325.74 MiB/sec @ 3 ghz | |
| Alignment 5 - 0.813 bytes/cycle - 2325.73 MiB/sec @ 3 ghz | |
| Alignment 6 - 0.813 bytes/cycle - 2325.73 MiB/sec @ 3 ghz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdint.h> | |
| #include <stdio.h> | |
| /* Permutations of {0, ..., 15} */ | |
| static const uint8_t SIGMA[14][16] = { | |
| { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, | |
| { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, | |
| { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, | |
| { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, | |
| { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package siphash | |
| // Hash returns the 64-bit SipHash-2-4 of the given 64-bit message m with two 64-bit | |
| // parts of 128-bit key: k0 and k1. | |
| func Hash(k0, k1, m uint64) uint64 { | |
| // Initialization. | |
| v0 := k0 ^ 0x736f6d6570736575 | |
| v1 := k1 ^ 0x646f72616e646f6d | |
| v2 := k0 ^ 0x6c7967656e657261 | |
| v3 := k1 ^ 0x7465646279746573 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // standard interface | |
| h := blake256.New() // or sha256.New(), or anything else | |
| h.Write([]byte("hello")) | |
| result := h.Sum(nil) // output 256-byte hash | |
| // standard interface too | |
| h := skein.NewHash(32) | |
| h.Write([]byte("hello")) | |
| result := h.Sum(nil) // output 256-byte hash | |
| // but also any hash length via OutputReader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <Cocoa/Cocoa.h> | |
| @interface CRTransparentSearchFieldCell : NSSearchFieldCell | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Мы изучаем каждый чужой автомобиль, | |
| который появляется на свет, чтобы открыть детали, которые могут быть | |
| разработаны дальше или приспособлены к нашим автомобилям. Если кто-нибудь | |
| работает лучше нас, мы, по крайней мере, хотим это знать и для этого | |
| покупаем по экземпляру каждого, вновь выходящего автомобиля. Обыкновенно на | |
| автомобиле некоторое время ездят и пробуют его, затем разбирают на части и | |
| точно исследуют, чтобы установить, как и из чего сконструирована каждая | |
| часть. Где-нибудь по соседству от Дирборна можно встретить образец каждого | |
| автомобиля, который фабриковался когда-либо на свете. Время от времени, | |
| когда мы опять покупаем новый автомобиль, об этом печатают в газетах и |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MASTER CARD format: | |
| 1 byte | 1 byte | 2 bytes | 2 bytes | 32 bytes | 32 bytes | 16 bytes | 6 bytes | 8 bytes | |
| =======|========|=========|=========|==========|***********************|=========|======== | |
| version| logN | r | p | salt | enc key | mac key | hash | MAC | |
| -------|---------------------------------------|-----------------------|---------|-------- | |
| | blakrypt parameters |encrypted with nonce=0 | | |
| enc key, mac key -- randomly generated keys for cards | |
| (stored in Master card encrypted and authenticated with keys derived from password.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5.5. Using wrong tools | |
| Using the wrong tools is obviously an intrinsically bad idea. The trouble is | |
| that often one discovers a tool’s inadequacy only after having invested a | |
| substantial amount of effort to 24 build and understand it, and the tool thus | |
| having become “valuable”. This happened to the author and his team when | |
| implementing the first Pascal compiler in 1969. | |
| The tools available for writing programs were an assembler, a Fortran and an | |
| Algol compiler. The latter was so poorly implemented that we did not dare rely |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun rst-to-html () | |
| "Convert current file from reStructuredText to HTML, outputting to file.html." | |
| (interactive) | |
| (when (not (stringp (buffer-file-name))) | |
| (error "No file name")) | |
| (message "Running...") | |
| (shell-command | |
| (concat "rst2html -d " | |
| (shell-quote-argument (buffer-file-name)) |