@@ -391,92 +391,6 @@ public struct RIPEMD160 {
391
391
392
392
return data
393
393
}
394
-
395
- // public mutating func update(data: Data) throws {
396
- // try data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in
397
- //
398
- // if let bodyAddress = body.baseAddress, body.count > 0 {
399
- // var ptr = bodyAddress.assumingMemoryBound(to: UInt8.self)
400
- // var length = data.count
401
- // var X = [UInt32](repeating: 0, count: 16)
402
- //
403
- // // Process remaining bytes from last call:
404
- // if buffer.count > 0 && buffer.count + length >= 64 {
405
- // let amount = 64 - buffer.count
406
- // buffer.append(ptr, count: amount)
407
- // try buffer.withUnsafeBytes { (body: UnsafeRawBufferPointer) in
408
- // if let bodyAddress = body.baseAddress, body.count > 0 {
409
- // let pointer = bodyAddress.assumingMemoryBound(to: Void.self)
410
- // _ = memcpy(&X, pointer, 64)
411
- // } else {
412
- // throw Web3Error.dataError
413
- // }
414
- // }
415
- // compress(X)
416
- // ptr += amount
417
- // length -= amount
418
- // }
419
- // // Process 64 byte chunks:
420
- // while length >= 64 {
421
- // memcpy(&X, ptr, 64)
422
- // compress(X)
423
- // ptr += 64
424
- // length -= 64
425
- // }
426
- // // Save remaining unprocessed bytes:
427
- // buffer = Data(bytes: ptr, count: length)
428
- // } else {
429
- // throw Web3Error.dataError
430
- // }
431
- //
432
- // }
433
- // count += Int64(data.count)
434
- // }
435
- //
436
- // public mutating func finalize() throws -> Data {
437
- // var X = [UInt32](repeating: 0, count: 16)
438
- // /* append the bit m_n == 1 */
439
- // buffer.append(0x80)
440
- // try buffer.withUnsafeBytes { (body: UnsafeRawBufferPointer) in
441
- // if let bodyAddress = body.baseAddress, body.count > 0 {
442
- // let pointer = bodyAddress.assumingMemoryBound(to: Void.self)
443
- // _ = memcpy(&X, pointer, buffer.count)
444
- // } else {
445
- // throw Web3Error.dataError
446
- // }
447
- // }
448
- //
449
- // if (count & 63) > 55 {
450
- // /* length goes to next block */
451
- // compress(X)
452
- // X = [UInt32](repeating: 0, count: 16)
453
- // }
454
- //
455
- // /* append length in bits */
456
- // let lswlen = UInt32(truncatingIfNeeded: count)
457
- // let mswlen = UInt32(UInt64(count) >> 32)
458
- // X[14] = lswlen << 3
459
- // X[15] = (lswlen >> 29) | (mswlen << 3)
460
- // compress(X)
461
- //
462
- // var data = Data(count: 20)
463
- // try data.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in
464
- // if let bodyAddress = body.baseAddress, body.count > 0 {
465
- // let pointer = bodyAddress.assumingMemoryBound(to: UInt32.self)
466
- // pointer[0] = MDbuf.0
467
- // pointer[1] = MDbuf.1
468
- // pointer[2] = MDbuf.2
469
- // pointer[3] = MDbuf.3
470
- // pointer[4] = MDbuf.4
471
- // } else {
472
- // throw Web3Error.dataError
473
- // }
474
- // }
475
- //
476
- // buffer = Data()
477
- //
478
- // return data
479
- // }
480
394
}
481
395
482
396
public extension RIPEMD160 {
0 commit comments