Projekt

Obecné

Profil

Stáhnout (2.32 KB) Statistiky
| Větev: | Revize:
1
declare var hash: Hash;
2

    
3
declare module "hash.js" {
4
    export = hash;
5
}
6

    
7
interface BlockHash<T> {
8
    hmacStrength: number
9
    padLength: number
10
    endian: 'big' | 'little'
11
}
12

    
13
interface MessageDigest<T> {
14
    blockSize: number
15
    outSize: number
16
    update(msg: any, enc?: 'hex'): T
17
    digest(): number[]
18
    digest(enc: 'hex'): string
19
}
20

    
21
interface Hash {
22
    hmac: HmacConstructor
23
    ripemd: RipemdSet
24
    ripemd160: Ripemd160Constructor
25
    sha: ShaSet
26
    sha1: Sha1Constructor
27
    sha224: Sha224Constructor
28
    sha256: Sha256Constructor
29
    sha384: Sha384Constructor
30
    sha512: Sha512Constructor
31
    utils: Utils
32
}
33

    
34
interface Utils {
35
    toArray(msg: any, enc: 'hex'): Array<number>
36
    toHex(msg: any): string
37
}
38

    
39
interface RipemdSet {
40
    ripemd160: Ripemd160Constructor
41
}
42

    
43
interface ShaSet {
44
    sha1: Sha1Constructor
45
    sha224: Sha224Constructor
46
    sha256: Sha256Constructor
47
    sha384: Sha384Constructor
48
    sha512: Sha512Constructor
49
}
50

    
51
interface HmacConstructor { (hash: BlockHash<any>, key: any, enc?: 'hex'): Hmac }
52
interface Ripemd160Constructor { (): Ripemd160 }
53
interface Sha1Constructor { (): Sha1; }
54
interface Sha224Constructor { (): Sha224; }
55
interface Sha256Constructor { (): Sha256; }
56
interface Sha384Constructor { (): Sha384; }
57
interface Sha512Constructor { (): Sha512; }
58

    
59
interface Hmac extends MessageDigest<Hmac> {
60
    blockSize: 512
61
    outSize: 160
62
}
63

    
64
interface Ripemd160 extends BlockHash<Ripemd160>, MessageDigest<Ripemd160> {
65
    blockSize: 512
66
    hmacStrength: 192
67
    outSize: 160
68
    padLength: 64
69
    endian: 'little'
70
}
71

    
72
interface Sha1 extends BlockHash<Sha1>, MessageDigest<Sha1> {
73
    blockSize: 512
74
    hmacStrength: 80
75
    outSize: 160
76
    padLength: 64
77
    endian: 'big'
78
}
79
interface Sha224 extends BlockHash<Sha224>, MessageDigest<Sha224> {
80
    blockSize: 512
81
    hmacStrength: 192
82
    outSize: 224
83
    padLength: 64
84
    endian: 'big'
85
}
86
interface Sha256 extends BlockHash<Sha256>, MessageDigest<Sha256> {
87
    blockSize: 512
88
    hmacStrength: 192
89
    outSize: 256
90
    padLength: 64
91
    endian: 'big'
92
}
93
interface Sha384 extends BlockHash<Sha384>, MessageDigest<Sha384> {
94
    blockSize: 1024
95
    hmacStrength: 192
96
    outSize: 384
97
    padLength: 128
98
    endian: 'big'
99
}
100
interface Sha512 extends BlockHash<Sha512>, MessageDigest<Sha512> {
101
    blockSize: 1024
102
    hmacStrength: 192
103
    outSize: 512
104
    padLength: 128
105
    endian: 'big'
106
}
(1-1/2)