dub icon indicating copy to clipboard operation
dub copied to clipboard

Shall we replace crc32Of with secure digest in pathToObjName()?

Open nordlow opened this issue 3 years ago • 0 comments

Grepping for import std.digest gave hit in pathToObjName. So, btw, shall we, in another PR, change crc32Of to SHA256 at

	static string pathToObjName(const scope ref BuildPlatform platform, string path)
	{
		import std.digest.crc : crc32Of;
		import std.path : buildNormalizedPath, dirSeparator, relativePath, stripDrive;
		if (path.endsWith(".d")) path = path[0 .. $-2];
		auto ret = buildNormalizedPath(getcwd(), path).replace(dirSeparator, ".");
		auto idx = ret.lastIndexOf('.');
		const objSuffix = getObjSuffix(platform);
		return idx < 0 ? ret ~ objSuffix : format("%s_%(%02x%)%s", ret[idx+1 .. $], crc32Of(ret[0 .. idx]), objSuffix);
	}

aswell? Ping, @kinke.

Originally posted by @nordlow in https://github.com/dlang/dub/issues/2386#issuecomment-1214964408

nordlow avatar Aug 15 '22 12:08 nordlow