mirror of
https://github.com/hanzoai/firebase-js-sdk.git
synced 2026-09-24 16:59:10 +00:00
Delete Hash base class in util (#1657)
Removes the Hash base class that is only used in Sha1 in @firebase/util. It only has a single property and only one class extends from it, so I think it's fair to say that it's not very useful. The actual reason of me doing this is that Rollup doesn't realize that extended classes that are transpiled to ES5 don't have side effects. Without this change, any package using Rollup that imports anything from @firebase/util (like FirebaseError or ErrorFactory) will also get Sha1 and Hash classes included in their bundle. I suspect that Webpack does something similar but I haven't checked. After this change, using Rollup, an iife build of a package that only exports ErrorFactory and FirebaseError from @firebase/util went from 1478 bytes to 544 bytes (minified + gzipped).
This commit is contained in:
committed by
GitHub
parent
6d91eeefd8
commit
be0b16536a
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Copyright 2011 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Abstract cryptographic hash interface.
|
||||
*
|
||||
* See Sha1 and Md5 for sample implementations.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cryptographic hash instance.
|
||||
*
|
||||
* @constructor
|
||||
* @struct
|
||||
*/
|
||||
export class Hash {
|
||||
/**
|
||||
* The block size for the hasher.
|
||||
* @type {number}
|
||||
*/
|
||||
blockSize: number = -1;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
@@ -15,8 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Hash } from './hash';
|
||||
|
||||
/**
|
||||
* @fileoverview SHA-1 cryptographic hash.
|
||||
* Variable names follow the notation in FIPS PUB 180-3:
|
||||
@@ -38,11 +36,10 @@ import { Hash } from './hash';
|
||||
*
|
||||
* The properties declared here are discussed in the above algorithm document.
|
||||
* @constructor
|
||||
* @extends {Hash}
|
||||
* @final
|
||||
* @struct
|
||||
*/
|
||||
export class Sha1 extends Hash {
|
||||
export class Sha1 {
|
||||
/**
|
||||
* Holds the previous values of accumulated variables a-e in the compress_
|
||||
* function.
|
||||
@@ -83,9 +80,9 @@ export class Sha1 extends Hash {
|
||||
*/
|
||||
private total_: number = 0;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
blockSize: number;
|
||||
|
||||
constructor() {
|
||||
this.blockSize = 512 / 8;
|
||||
|
||||
this.pad_[0] = 128;
|
||||
|
||||
Reference in New Issue
Block a user