This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from "crypto"; | |
export class AES128 { | |
private iv: NodeJS.ArrayBufferView; | |
private key: NodeJS.ArrayBufferView; | |
constructor(key: string, iv: string) { | |
if (key.length !== 16) { | |
throw new Error( | |
"Não foi possível construir o AES128 devido ao key que possui um comprimento diferente de 16." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { edenFetch } from "@elysiajs/eden"; | |
export interface BaseResponse<T = any> { | |
success: boolean; | |
message?: string; | |
data?: T; | |
} | |
export interface ServiceResponse<T = any> { | |
status: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fib = (laps, oldNumber = 1, oldestNumber = 0) => { | |
if (laps === 0) return oldestNumber; | |
if (laps === 1) return oldNumber; | |
const sum = BigInt(oldNumber) + BigInt(oldestNumber); | |
return fib(laps - 1, sum, oldNumber); | |
}; | |
console.time("res"); | |
console.log(fib(1_000_000)) | |
console.timeEnd("res"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const factorial = (number) => { | |
if (number <= 1) return 1; | |
return BigInt(number) * BigInt(factorial(number - 1)); | |
} | |
console.time("res"); | |
console.log(factorial(31_931)) | |
console.timeEnd("res"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HttpRequest { | |
public baseUrl: string; | |
constructor(baseUrl: string) { | |
this.baseUrl = baseUrl; | |
} | |
private headerBuilder = (data: object): Headers => { | |
return new Headers(Object.entries(data)); | |
}; |
NewerOlder