Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
crypto.js217 linesDownload Raw Back to utils
1"use strict";2var __create = Object.create;3var __defProp = Object.defineProperty;4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;5var __getOwnPropNames = Object.getOwnPropertyNames;6var __getProtoOf = Object.getPrototypeOf;7var __hasOwnProp = Object.prototype.hasOwnProperty;8var __export = (target, all) => {9  for (var name in all)10    __defProp(target, name, { get: all[name], enumerable: true });11};12var __copyProps = (to, from, except, desc) => {13  if (from && typeof from === "object" || typeof from === "function") {14    for (let key of __getOwnPropNames(from))15      if (!__hasOwnProp.call(to, key) && key !== except)16        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });17  }18  return to;19};20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(21  // If the importer is in node compatibility mode or this is not an ESM22  // file that has been converted to a CommonJS file using a Babel-23  // compatible transform (i.e. "__esModule" has not been set), then set24  // "default" to the CommonJS "module.exports" for node compatibility.25  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,26  mod27));28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);29var crypto_exports = {};30__export(crypto_exports, {31  calculateSha1: () => calculateSha1,32  createGuid: () => createGuid,33  generateSelfSignedCertificate: () => generateSelfSignedCertificate34});35module.exports = __toCommonJS(crypto_exports);36var import_crypto = __toESM(require("crypto"));37var import_assert = require("../../utils/isomorphic/assert");38function createGuid() {39  return import_crypto.default.randomBytes(16).toString("hex");40}41function calculateSha1(buffer) {42  const hash = import_crypto.default.createHash("sha1");43  hash.update(buffer);44  return hash.digest("hex");45}46function encodeBase128(value) {47  const bytes = [];48  do {49    let byte = value & 127;50    value >>>= 7;51    if (bytes.length > 0)52      byte |= 128;53    bytes.push(byte);54  } while (value > 0);55  return Buffer.from(bytes.reverse());56}57class DER {58  static encodeSequence(data) {59    return this._encode(48, Buffer.concat(data));60  }61  static encodeInteger(data) {62    (0, import_assert.assert)(data >= -128 && data <= 127);63    return this._encode(2, Buffer.from([data]));64  }65  static encodeObjectIdentifier(oid) {66    const parts = oid.split(".").map((v) => Number(v));67    const output = [encodeBase128(40 * parts[0] + parts[1])];68    for (let i = 2; i < parts.length; i++)69      output.push(encodeBase128(parts[i]));70    return this._encode(6, Buffer.concat(output));71  }72  static encodeNull() {73    return Buffer.from([5, 0]);74  }75  static encodeSet(data) {76    (0, import_assert.assert)(data.length === 1, "Only one item in the set is supported. We'd need to sort the data to support more.");77    return this._encode(49, Buffer.concat(data));78  }79  static encodeExplicitContextDependent(tag, data) {80    return this._encode(160 + tag, data);81  }82  static encodePrintableString(data) {83    return this._encode(19, Buffer.from(data));84  }85  static encodeBitString(data) {86    const unusedBits = 0;87    const content = Buffer.concat([Buffer.from([unusedBits]), data]);88    return this._encode(3, content);89  }90  static encodeDate(date) {91    const year = date.getUTCFullYear();92    const isGeneralizedTime = year >= 2050;93    const parts = [94      isGeneralizedTime ? year.toString() : year.toString().slice(-2),95      (date.getUTCMonth() + 1).toString().padStart(2, "0"),96      date.getUTCDate().toString().padStart(2, "0"),97      date.getUTCHours().toString().padStart(2, "0"),98      date.getUTCMinutes().toString().padStart(2, "0"),99      date.getUTCSeconds().toString().padStart(2, "0")100    ];101    const encodedDate = parts.join("") + "Z";102    const tag = isGeneralizedTime ? 24 : 23;103    return this._encode(tag, Buffer.from(encodedDate));104  }105  static _encode(tag, data) {106    const lengthBytes = this._encodeLength(data.length);107    return Buffer.concat([Buffer.from([tag]), lengthBytes, data]);108  }109  static _encodeLength(length) {110    if (length < 128) {111      return Buffer.from([length]);112    } else {113      const lengthBytes = [];114      while (length > 0) {115        lengthBytes.unshift(length & 255);116        length >>= 8;117      }118      return Buffer.from([128 | lengthBytes.length, ...lengthBytes]);119    }120  }121}122function generateSelfSignedCertificate() {123  const { privateKey, publicKey } = import_crypto.default.generateKeyPairSync("rsa", { modulusLength: 2048 });124  const publicKeyDer = publicKey.export({ type: "pkcs1", format: "der" });125  const oneYearInMilliseconds = 365 * 24 * 60 * 60 * 1e3;126  const notBefore = new Date((/* @__PURE__ */ new Date()).getTime() - oneYearInMilliseconds);127  const notAfter = new Date((/* @__PURE__ */ new Date()).getTime() + oneYearInMilliseconds);128  const tbsCertificate = DER.encodeSequence([129    DER.encodeExplicitContextDependent(0, DER.encodeInteger(1)),130    // version131    DER.encodeInteger(1),132    // serialNumber133    DER.encodeSequence([134      DER.encodeObjectIdentifier("1.2.840.113549.1.1.11"),135      // sha256WithRSAEncryption PKCS #1136      DER.encodeNull()137    ]),138    // signature139    DER.encodeSequence([140      DER.encodeSet([141        DER.encodeSequence([142          DER.encodeObjectIdentifier("2.5.4.3"),143          // commonName X.520 DN component144          DER.encodePrintableString("localhost")145        ])146      ]),147      DER.encodeSet([148        DER.encodeSequence([149          DER.encodeObjectIdentifier("2.5.4.10"),150          // organizationName X.520 DN component151          DER.encodePrintableString("Playwright Client Certificate Support")152        ])153      ])154    ]),155    // issuer156    DER.encodeSequence([157      DER.encodeDate(notBefore),158      // notBefore159      DER.encodeDate(notAfter)160      // notAfter161    ]),162    // validity163    DER.encodeSequence([164      DER.encodeSet([165        DER.encodeSequence([166          DER.encodeObjectIdentifier("2.5.4.3"),167          // commonName X.520 DN component168          DER.encodePrintableString("localhost")169        ])170      ]),171      DER.encodeSet([172        DER.encodeSequence([173          DER.encodeObjectIdentifier("2.5.4.10"),174          // organizationName X.520 DN component175          DER.encodePrintableString("Playwright Client Certificate Support")176        ])177      ])178    ]),179    // subject180    DER.encodeSequence([181      DER.encodeSequence([182        DER.encodeObjectIdentifier("1.2.840.113549.1.1.1"),183        // rsaEncryption PKCS #1184        DER.encodeNull()185      ]),186      DER.encodeBitString(publicKeyDer)187    ])188    // SubjectPublicKeyInfo189  ]);190  const signature = import_crypto.default.sign("sha256", tbsCertificate, privateKey);191  const certificate = DER.encodeSequence([192    tbsCertificate,193    DER.encodeSequence([194      DER.encodeObjectIdentifier("1.2.840.113549.1.1.11"),195      // sha256WithRSAEncryption PKCS #1196      DER.encodeNull()197    ]),198    DER.encodeBitString(signature)199  ]);200  const certPem = [201    "-----BEGIN CERTIFICATE-----",202    // Split the base64 string into lines of 64 characters203    certificate.toString("base64").match(/.{1,64}/g).join("\n"),204    "-----END CERTIFICATE-----"205  ].join("\n");206  return {207    cert: certPem,208    key: privateKey.export({ type: "pkcs1", format: "pem" })209  };210}211// Annotate the CommonJS export names for ESM import in node:2120 && (module.exports = {213  calculateSha1,214  createGuid,215  generateSelfSignedCertificate216});217 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai