How to use ts-md5 - 10 common examples

To help you get started, we’ve selected a few ts-md5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github foli / ngFire-Course / src / app / shared / upload / upload.service.ts View on Github external
uploadTask(path, file, meta, uploadType) {
    const nameHash = Md5.hashStr(file.name + new Date().getTime());
    const fileExt = file.type.split('/')[1];
    const name = `${nameHash}.${fileExt}`;

    const newMeta = {
      ...meta,
      someMoreData: 'Moooore data'
    };

    const ref = this.storage.ref(`${path}/${name}`);
    const task = ref.put(file, { customMetadata: newMeta });

    // add the following lines
    task.snapshotChanges().pipe(
      finalize(() => {
        this.downloadURL = ref.getDownloadURL();
        console.log('Image Uploaded!');
github yduartep / angular-full-sample / src / app / core / services / auth.helper.ts View on Github external
case AuthScheme.BEARER:
        const token = CommonUtil.getCookie(AuthHelper.TOKEN_ID);
        if (!CommonUtil.isEmpty(token)) {
          headers.set('Authorization', 'Bearer ' + token);
        }
        break;
      case AuthScheme.DIGEST:
        if (!CommonUtil.isEmpty(user)) {
          // TODO check from where arrive this fields
          const nonce = 'dcd98b7102dd2f0e8b11d0f600bfb0c093';
          const nc = '00000001';
          const cnonce = '0a4f113b';
          const opaque = '5ccc069c403ebaf9f0171e9517f40e41';
          const qop = 'auth';

          const HA1 = Md5.hashStr(user.username + ':' + user.email + ':' + user.password);
          const HA2 = Md5.hashStr(method + ':' + uri);
          const response = Md5.hashStr(HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2);

          headers.set('Authorization', 'Digest ' +
            ' username="' + user.username + '",' +
            ' realm="' + user.email + '",' +
            ' nonce="' + nonce + '",' +
            ' uri="' + uri + '",' +
            ' qop=auth,' +
            ' nc=' + nc + ',' +
            ' cnonce="' + cnonce + '",' +
            ' response="' + response + '",' +
            ' opaque="' + opaque + '"');
        }
        break;
      case AuthScheme.HOBA:
github moodlehq / moodlemobile2 / src / addon / messages / pages / discussion / discussion.ts View on Github external
protected addMessage(message: any, keep: boolean = true): void {
        /* Create a hash to identify the message. The text of online messages isn't reliable because it can have random data
           like VideoJS ID. Try to use id and fallback to text for offline messages. */
        message.hash = Md5.hashAsciiStr(String(message.id || message.text || '')) + '#' + message.timecreated + '#' +
                message.useridfrom;

        if (typeof this.keepMessageMap[message.hash] === 'undefined') {
            // Message not added to the list. Add it now.
            this.messages.push(message);
        }
        // Message needs to be kept in the list.
        this.keepMessageMap[message.hash] = keep;
    }
github airsonic / airsonic-ui / src / app / shared / service / auth.service.ts View on Github external
loginMyUser(username: string, password: string, server: string) {
    // Log user in
    const salt = this.generateSalt();
    const token = new Md5().appendStr(password).appendStr(salt).end().toString();
    const myUser: MyUser = {
      name: username,
      salt: salt,
      token: token,
      server: server
    };
    localStorage.setItem(USER_INFO, JSON.stringify(myUser));
    localStorage.setItem(SERVER_URL, server);
    this.loadMyRoles(username);
    this.loadMyFolders(username);
  }
github cloudfoundry / stratos / src / frontend / app / shared / data-services / scm / gitlab-scm.ts View on Github external
private convertCommit(projectName: string, commit: any): GitCommit {
    const emailMD5 = Md5.hashStr(commit.author_email);
    const avatarURL = `https://secure.gravatar.com/avatar/${emailMD5}?s=120&d=identicon`;

    return {
      html_url: this.getCommitURL(projectName, commit.id),
      author: {
        id: null,
        login: null,
        avatar_url: avatarURL,
        html_url: null
      },
      commit: {
        author: {
          date: commit.created_at,
          name: commit.author_name,
          email: commit.author_email
        },
github lhzbxx / Follow3 / mobile / app / providers / data-service.js View on Github external
resetPassword(email, password, nav) {
        let url = this.BASE_URL + 'auth/reset';
        let body = JSON.stringify({'email': email, 'password': Md5.hashStr(password)});
        let headers = new Headers({'Content-Type': 'application/json'});
        return new Promise(resolve => {
            this.http.patch(url, body, {headers: headers})
                .map(res => res.json())
                .subscribe(data => {
                    console.log(data.msg);
                    if (data.status == 200) {
                        resolve();
                    } else {
                        this.showToast('修改失败...', 2000, nav);
                    }
                }, error => {
                    this.showToast('无法连接到服务器...', 2000, nav);
                });
        });
    }
github aws / lumberyard / dev / Gems / CloudGemFramework / v1 / Website / CloudGemPortal / app / view / game / module / cloudgems / service / cachehandler.service.ts View on Github external
public exists(key: string): boolean {        
        var encryptedKeyString = Md5.hashStr(key).toString();
        var valueExists = this.cacheMap.has(encryptedKeyString);
        if (valueExists) {
            return true;
        }
        return false;
    }
    public objectExists(key: any): boolean {
github search-future / miyou.tv / miyoutv / src / app / shared / garapon.service.ts View on Github external
get md5password(): string {
    return Md5.hashStr(this.password) as string;
  }
github jan-molak / serenity-js / packages / serenity-js / src / serenity / reporting / serenity_bdd_reporter.ts View on Github external
private persistReportFor({ value }: SceneFinished) {
        const filename = `${ Md5.hashStr(value.subject.id) }.json`;

        this.stage.manager.informOfWorkInProgress(
            RehearsalReport.from(this.stage.manager.readNewJournalEntriesAs('SerenityBDDReporter'))
                .exportedUsing(new SerenityBDDReportExporter())
                .then((fullReport: FullReport) => Promise.all(
                    fullReport.scenes.map(
                        (scene: SceneReport) => this.fs.store(filename, JSON.stringify(scene)),
                    ),
                )),
        );
    }
}

ts-md5

TypeScript MD5 implementation

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis